Last active
August 29, 2015 14:26
-
-
Save taniadaniela/ec98d2645764fcb9b644 to your computer and use it in GitHub Desktop.
factory for add an image to a spree product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in collaboration with @edipox