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
"user-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org"
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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.