Sha256: 29e17de35384d1553ccccc471c19187bf23df919fc12b61944978103a4a6ffb2

Contents?: true

Size: 790 Bytes

Versions: 11

Compression:

Stored size: 790 Bytes

Contents

FactoryBot.define do
  factory :kithe_asset, class: 'Kithe::Asset' do
    title { "Some Asset" }

    trait :with_file do
      transient do
        file_object { File.open(Kithe::Engine.root.join("spec/test_support/images/1x1_pixel.jpg")) }
      end
      file { file_object }
    end

    trait :with_faked_metadata do
      with_file

      transient do
        faked_metadata { {} }
      end

      after(:build) do |model, evaluator|
        if evaluator.faked_metadata
          model.file.metadata.merge!(evaluator.faked_metadata.stringify_keys)
        end
      end
    end

    # No bytestreams, but a derivative
    trait :faked_derivatives do
      derivatives {[
        Kithe::Derivative.new(key: "one"),
        Kithe::Derivative.new(key: "two")
      ]}
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kithe-2.0.2 spec/factories/kithe_assets.rb
kithe-2.0.1 spec/factories/kithe_assets.rb
kithe-2.0.0 spec/factories/kithe_assets.rb
kithe-2.0.0.pre.rc1 spec/factories/kithe_assets.rb
kithe-2.0.0.pre.beta1 spec/factories/kithe_assets.rb
kithe-2.0.0.pre.alpha2 spec/factories/kithe_assets.rb
kithe-2.0.0.pre.alpha1 spec/factories/kithe_assets.rb
kithe-1.1.2 spec/factories/kithe_assets.rb
kithe-1.1.1 spec/factories/kithe_assets.rb
kithe-1.1.0 spec/factories/kithe_assets.rb
kithe-1.0.0 spec/factories/kithe_assets.rb