I wonder if it’s possible to simulate Paperclip’s has_attached_file
with Factory Girl and then test it with Rspec. I don’t get it to work.
My factories.rb file looks like this:
Factory.define :user do |user|
user.email “[email protected]”
My Rspec test (users_controller_spec.rb) looks like this:
it “should have a profile image” do
get :show, :id => @user
And I get the following error:
UsersController GET ‘show’ should have a profile image
Failure/Error: @user = Factory(:user)
undefined method `avatar_file_name=’ for #User:0x000001037cc550
I have followed these instructions,
Any help would be greatly appreciated! I’m a newbie to Rails so it may
be something simple.