1st Fri
Testで使うファイルをどこに置くべきか
UnitTestやFunctionalTestの中から参照するファイルをどこに置くべきか
という疑問について、明確な回答を用意できていなかったのですが、
Railsのソースの中で答えらしきものを見つけたので紹介します。
actionpack/lib/action_controller/test_process.rb L325
rails>>
Usage example, within a functional test:
post :change_avatar, :avatar => ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + '/files/spongebob.png', 'image/png')
<<--
このExampleによると、test/fixtures/filesというディレクトリを作り、
その中にファイルを置いているようです。
posted by
genki on Fri 1 Feb 2008 at 00:33 with 0 comments