debian-mirror-gitlab/spec/serializers/test_case_entity_spec.rb

34 lines
1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
require 'spec_helper'
describe TestCaseEntity do
include TestReportsHelper
let(:entity) { described_class.new(test_case) }
describe '#as_json' do
subject { entity.as_json }
context 'when test case is success' do
let(:test_case) { create_test_case_rspec_success }
it 'contains correct test case details' do
expect(subject[:status]).to eq('success')
expect(subject[:name]).to eq('Test#sum when a is 1 and b is 3 returns summary')
2019-09-04 21:01:54 +05:30
expect(subject[:classname]).to eq('spec.test_spec')
2018-11-18 11:00:15 +05:30
expect(subject[:execution_time]).to eq(1.11)
end
end
context 'when test case is failed' do
let(:test_case) { create_test_case_rspec_failed }
it 'contains correct test case details' do
expect(subject[:status]).to eq('failed')
2019-09-30 21:07:59 +05:30
expect(subject[:name]).to eq('Test#sum when a is 1 and b is 3 returns summary')
2019-09-04 21:01:54 +05:30
expect(subject[:classname]).to eq('spec.test_spec')
2018-11-18 11:00:15 +05:30
expect(subject[:execution_time]).to eq(2.22)
end
end
end
end