Sha256: f9fb049805d49e0c868fa84a94abc4c919bbc7e7ef507469c3c1c8dabcd00645

Contents?: true

Size: 1.24 KB

Versions: 60

Compression:

Stored size: 1.24 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 { '[]' }
    input_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

60 entries across 60 versions & 1 rubygems

Version Path
inferno_core-0.4.43 spec/factories/result.rb
inferno_core-0.4.42 spec/factories/result.rb
inferno_core-0.4.41 spec/factories/result.rb
inferno_core-0.4.40 spec/factories/result.rb
inferno_core-0.4.39 spec/factories/result.rb
inferno_core-0.4.38 spec/factories/result.rb
inferno_core-0.4.35 spec/factories/result.rb
inferno_core-0.4.34 spec/factories/result.rb
inferno_core-0.4.33 spec/factories/result.rb
inferno_core-0.4.32 spec/factories/result.rb
inferno_core-0.4.31 spec/factories/result.rb
inferno_core-0.4.30 spec/factories/result.rb
inferno_core-0.4.29 spec/factories/result.rb
inferno_core-0.4.28 spec/factories/result.rb
inferno_core-0.4.27 spec/factories/result.rb
inferno_core-0.4.26 spec/factories/result.rb
inferno_core-0.4.25 spec/factories/result.rb
inferno_core-0.4.24 spec/factories/result.rb
inferno_core-0.4.23 spec/factories/result.rb
inferno_core-0.4.22 spec/factories/result.rb