gitlab-org--gitlab-foss/spec/serializers/test_case_entity_spec.rb
Kamil Trzciński a08209ffa3 Limit amount of JUnit tests returned
Currently, we do not cap amount of tests returned to frontend,
thus in some extreme cases we can see a MBs of data stored in Redis.

This adds an upper limit of 100 tests per-suite.

We will continue showing the total counters correctly,
but we will limit amount of tests that will be presented.
2019-07-03 22:27:14 +02:00

33 lines
1 KiB
Ruby

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')
expect(subject[:classname]).to eq('spec.test_spec')
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')
expect(subject[:name]).to eq('Test#sum when a is 1 and b is 3 returns summary')
expect(subject[:classname]).to eq('spec.test_spec')
expect(subject[:execution_time]).to eq(2.22)
end
end
end
end