Let activerecord handle the picture upload in factories

This commit is contained in:
Henne Vogelsang 2016-05-03 12:13:23 +02:00
parent c876a2d1cf
commit 5b20c992ae
2 changed files with 8 additions and 9 deletions

View file

@ -46,10 +46,10 @@ FactoryGirl.define do
create(:question, conferences: [conference])
# Logo...
uploader = PictureUploader.new(conference, :picture)
File.open('app/assets/images/rails.png') { |f| uploader.store!(f) }
conference.logo_file_name = 'rails.png'
conference.save
File.open("spec/support/logos/#{1 + rand(13)}.png") do |file|
conference.picture = file
end
conference.save!
end
end
end