module Spree::TestingSupport::ImageHelpers

Public Instance Methods

create_image(attachable, file) click to toggle source
# File lib/spree/testing_support/image_helpers.rb, line 4
def create_image(attachable, file)
  image = attachable.images.new
  image.attachment.attach(io: file, filename: File.basename(file))
  image.save!
  file.rewind
  image
end