2020-03-12 18:09:28 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
FactoryBot.define do
|
|
|
|
factory :test_case, class: 'Gitlab::Ci::Reports::TestCase' do
|
|
|
|
name { "test-1" }
|
|
|
|
classname { "trace" }
|
|
|
|
file { "spec/trace_spec.rb" }
|
|
|
|
execution_time { 1.23 }
|
2020-04-03 00:07:49 +00:00
|
|
|
status { Gitlab::Ci::Reports::TestCase::STATUS_SUCCESS }
|
2020-03-12 18:09:28 +00:00
|
|
|
system_output { nil }
|
|
|
|
attachment { nil }
|
2020-03-26 06:08:40 +00:00
|
|
|
association :job, factory: :ci_build
|
2020-03-12 18:09:28 +00:00
|
|
|
|
2020-04-02 06:07:52 +00:00
|
|
|
trait :failed do
|
2020-04-03 00:07:49 +00:00
|
|
|
status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
|
|
|
|
system_output { "Failure/Error: is_expected.to eq(300) expected: 300 got: -100" }
|
2020-04-02 06:07:52 +00:00
|
|
|
end
|
|
|
|
|
2020-03-12 18:09:28 +00:00
|
|
|
trait :with_attachment do
|
2020-04-03 00:07:49 +00:00
|
|
|
status { Gitlab::Ci::Reports::TestCase::STATUS_FAILED }
|
2020-03-12 18:09:28 +00:00
|
|
|
attachment { "some/path.png" }
|
|
|
|
end
|
|
|
|
|
|
|
|
skip_create
|
|
|
|
|
|
|
|
initialize_with do
|
|
|
|
new(
|
|
|
|
name: name,
|
|
|
|
classname: classname,
|
|
|
|
file: file,
|
|
|
|
execution_time: execution_time,
|
|
|
|
status: status,
|
|
|
|
system_output: system_output,
|
2020-03-26 06:08:40 +00:00
|
|
|
attachment: attachment,
|
|
|
|
job: job
|
2020-03-12 18:09:28 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|