Sha256: baccbcdf83b3b20c09758ae5e81c781d3c13160f1db2f6f58cfd9d7504d25d18

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

FactoryBot.define do
  factory :result, class: 'Inferno::Entities::Result' do
    transient do
      runnable { test_run.runnable.reference_hash }
      test_run { repo_create(:test_run) }
      test_session { test_run.test_session }
      message_count { 0 }
      request_count { 0 }
    end

    test_session_id { test_session.id }
    test_run_id { test_run.id }

    test_suite_id { runnable[:test_suite_id] }
    test_group_id { runnable[:test_group_id] }
    test_id { runnable[:test_id] }
    output_json { '[]' }

    result { 'pass' }

    initialize_with { new(**attributes) }

    before(:create) do |instance, evaluator|
      instance.instance_variable_set(
        :@requests,
        build_list(:request, evaluator.request_count, result: instance)
      )
    end

    to_create do |instance|
      Inferno::Repositories::Results.new.create(instance.to_hash)
    end

    after(:create) do |instance, evaluator|
      instance.instance_variable_set(
        :@messages,
        repo_create_list(:message, evaluator.message_count, result_id: instance.id)
      )
      instance.instance_variable_set(
        :@requests,
        repo_create_list(:request, evaluator.request_count, result_id: instance.id)
      )
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
inferno_core-0.2.0 spec/factories/result.rb
inferno_core-0.2.0.rc4 spec/factories/result.rb
inferno_core-0.2.0.rc3 spec/factories/result.rb
inferno_core-0.2.0.rc2 spec/factories/result.rb
inferno_core-0.2.0.rc1 spec/factories/result.rb
inferno_core-0.1.4.pre spec/factories/result.rb
inferno_core-0.1.3 spec/factories/result.rb
inferno_core-0.1.3.pre2 spec/factories/result.rb
inferno_core-0.1.3.pre spec/factories/result.rb
inferno_core-0.1.2 spec/factories/result.rb
inferno_core-0.1.2.pre spec/factories/result.rb
inferno_core-0.1.1 spec/factories/result.rb
inferno_core-0.1.1.pre spec/factories/result.rb
inferno_core-0.1.0 spec/factories/result.rb
inferno_core-0.1.0.pre spec/factories/result.rb