UnitTestやFunctionalTestの中から参照するファイルをどこに置くべきか という疑問について、明確な回答を用意できていなかったのですが、 Railsのソースの中で答えらしきものを見つけたので紹介します。

actionpack/lib/action_controller/test_process.rb L325

   1    # Usage example, within a functional test:
   2    #   post :change_avatar, :avatar => ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + '/files/spongebob.png', 'image/png')

このExampleによると、test/fixtures/filesというディレクトリを作り、 その中にファイルを置いているようです。

posted by Png genki on Fri 1 Feb 2008 at 00:33

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry328
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ