Sha256: 318d1962ff3d7dba917b01debf19e657c843e1a2194d03f8719ee090780147a5

Contents?: true

Size: 1002 Bytes

Versions: 5

Compression:

Stored size: 1002 Bytes

Contents

module Pageflow
  class TestHostedFile < ActiveRecord::Base
    self.table_name = 'test_hosted_files'
    include HostedFile
  end

  FactoryBot.define do
    factory :hosted_file, class: TestHostedFile do
      trait :on_filesystem do
        attachment_on_filesystem File.open(Engine.root.join('spec', 'fixtures', 'image.png'))
        attachment_on_s3 nil
        state 'not_uploaded_to_s3'
      end

      trait :uploading_to_s3_failed do
        attachment_on_filesystem File.open(Engine.root.join('spec', 'fixtures', 'image.png'))
        attachment_on_s3 nil
        state 'uploading_to_s3_failed'
      end

      trait :uploaded_to_s3 do
        attachment_on_s3 File.open(Engine.root.join('spec', 'fixtures', 'image.png'))
        state 'uploaded_to_s3'
      end

      trait :with_overridden_keep_on_filesystem do
        after(:build) do |hosted_file|
          def hosted_file.keep_on_filesystem_after_upload_to_s3?
            true
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pageflow-13.0.0.beta5 spec/factories/hosted_files.rb
pageflow-13.0.0.beta4 spec/factories/hosted_files.rb
pageflow-13.0.0.beta3 spec/factories/hosted_files.rb
pageflow-13.0.0.beta2 spec/factories/hosted_files.rb
pageflow-13.0.0.beta1 spec/factories/hosted_files.rb