Sha256: 438408ef6ba5cd36c3bb1a0fc17d17664ef3ca5d153e570737841b6d03762584

Contents?: true

Size: 815 Bytes

Versions: 4

Compression:

Stored size: 815 Bytes

Contents

FactoryGirl.define do
  factory :fine_print_contract, :class => FinePrint::Contract do
    name { Faker::Lorem.words.join('_') }
    title { Faker::Lorem.words.join(' ').capitalize }
    content { Faker::Lorem.paragraphs.join("\n") }

    trait :published do
      transient do
        user_factory :user
        signatures_count 0
      end

      after(:build) do |contract, evaluator|
        contract.version = (contract.same_name.published
                                    .first.try(:version) || 0) + 1

        evaluator.signatures_count.times do 
          contract.signatures << FactoryGirl.build(
                                   :fine_print_signature,
                                   user_factory: evaluator.user_factory
                                 )
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fine_print-2.3.1 spec/factories/fine_print/contract.rb
fine_print-2.3.0 spec/factories/fine_print/contract.rb
fine_print-2.2.1 spec/factories/fine_print/contract.rb
fine_print-2.2.0 spec/factories/fine_print/contract.rb