Hello!

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.name                  "Anders"
  user.email                 "u...@example.com"
  user.password              "foobar"
  user.password_confirmation "foobar"
  user.avatar_file_name      "avatar"
end

My Rspec test (users_controller_spec.rb) looks like this:

it "should have a profile image" do
  get :show, :id => @user
  should have_attached_file(:avatar)
end

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, http://github.com/thoughtbot/paperclip.

Any help would be greatly appreciated! I'm a newbie to Rails so it may
be something simple.

Thanks!

// Anders


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to