Sha256: 7a0f3cfb1c0ae2ae593d5a484c9f0dd27ae0b06545463ef5f7d002ad8c52c9ae

Contents?: true

Size: 516 Bytes

Versions: 19

Compression:

Stored size: 516 Bytes

Contents

module Spree
  module TestingSupport
    module ImageHelpers
      def create_image(attachable, file)
        # user paperclip to attach an image
        if Rails.application.config.use_paperclip
          attachable.images.create!(attachment: file)
        # use ActiveStorage (default)
        else
          image = attachable.images.new
          image.attachment.attach(io: file, filename: File.basename(file))
          image.save!
          file.rewind
          image
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
spree_core-3.7.14.1 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.14 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.13 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.12 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.11 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.10 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.9 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.8 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.7 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.6 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.5 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.4 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.3 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.2 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.1 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.0 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.0.rc3 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.0.rc2 lib/spree/testing_support/image_helpers.rb
spree_core-3.7.0.rc1 lib/spree/testing_support/image_helpers.rb