Skip to content

How to: Use test fixtures

clyfe edited this page May 31, 2011 · 9 revisions

Whereas other gems such as Paperclip allow you to sham mounted uploaders as Strings, CarrierWave requires actual files. Here is an example blueprints.rb file:

# Machinist example
Sham.image { File.open("#{Rails.root}/test/fixtures/files/rails.png") }
User.blueprint do
  avatar { Sham.image }
end

EDIT:
I belive StringIO's also work

Clone this wiki locally