Skip to content

Instantly share code, notes, and snippets.

@taniadaniela
Last active August 29, 2015 14:26
Show Gist options
  • Save taniadaniela/ec98d2645764fcb9b644 to your computer and use it in GitHub Desktop.
Save taniadaniela/ec98d2645764fcb9b644 to your computer and use it in GitHub Desktop.
factory for add an image to a spree product
FactoryGirl.define do
factory :product_with_image, parent: :product do
after :create do |p|
image = File.open("spec/support/images/image.jpg")
p.images.create!(attachment: image, alt: p.name)
end
end
end
@taniadaniela
Copy link
Author

in collaboration with @edipox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment