私はこの仕様を持っています:
post :create, :room_id => @room.id, :image => Rack::Test::UploadedFile.new(path, 'text/jpg')
response.should redirect_to admin_room_path(@room)
@room.reload.pictures.count.should == 1
pic = @room.pictures.first
File.open(pic.image.url).should == File.open(path)
# Not working
次のエラーで失敗します:
1) Admin::PicturesController should fail to upload a new picture
Failure/Error: File.open(pic.image.url).should == File.open(path)
Errno::ENOENT:
No such file or directory - /uploads/picture/image/5134d0fa93ff007fcd000016/image1.jpg
# ./spec/controllers/admin/pictures_controller_spec.rb:26:in `initialize'
# ./spec/controllers/admin/pictures_controller_spec.rb:26:in `open'
# ./spec/controllers/admin/pictures_controller_spec.rb:26:in `block (2 levels) in <top (required)>'
ファイルが見つかりませんが、ディレクトリ/uploads/picture/image/5134d0fa93ff007fcd000016/
が作成されます。
ファイル以外はすべて正しいです。
私の初期化子:
if Rails.env.test? or Rails.env.cucumber?
CarrierWave.configure do |config|
config.storage = :file
config.enable_processing = true
end
end
私は何かが足りないのですか?