以下の内容はhttps://chulip.org/entry/2013/04/22/193814より取得しました。


FactoryGirlでCarrierWaveのテストデータを作る

Githubのwikiに書いてある。

Attaching a file to a FactoryGirl object is pretty much identical.

Factory.define :brand do |f|
  f.name "My Brand"
  f.description "Foo"
  f.logo { Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec', 'support', 'brands', 'logos', 'logo_image.jpg')) }
end

As far as I can tell the curly braces are required to make FactoryGirl attach it lazily, i.e. whenever the factory is built.
https://github.com/jnicklas/carrierwave/wiki/How-to%3A-Use-test-fixtures

fixture_file_uploadを使う方法もあるらしい。これはActionDispatch::TestProcessに定義されている。




以上の内容はhttps://chulip.org/entry/2013/04/22/193814より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14