diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 06:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-02 06:07:52 +0000 |
commit | ba836d98593d68d8d6c22c540e31c8031a786bd8 (patch) | |
tree | 09e500506edc566b08ea006ce41aa411990b9236 /spec | |
parent | 796b00a98a82fcbe082c9343fd4efcccc77478dc (diff) | |
download | gitlab-ce-ba836d98593d68d8d6c22c540e31c8031a786bd8.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/ci/test_case.rb | 5 | ||||
-rw-r--r-- | spec/javascripts/ide/components/commit_sidebar/actions_spec.js | 7 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/reports/test_reports_spec.rb | 32 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/reports/test_suite_spec.rb | 29 |
4 files changed, 73 insertions, 0 deletions
diff --git a/spec/factories/ci/test_case.rb b/spec/factories/ci/test_case.rb index ce6bd0f3d7d..dc0e7c762ab 100644 --- a/spec/factories/ci/test_case.rb +++ b/spec/factories/ci/test_case.rb @@ -11,7 +11,12 @@ FactoryBot.define do attachment { nil } association :job, factory: :ci_build + trait :failed do + status { "failed" } + end + trait :with_attachment do + status { "failed" } attachment { "some/path.png" } end diff --git a/spec/javascripts/ide/components/commit_sidebar/actions_spec.js b/spec/javascripts/ide/components/commit_sidebar/actions_spec.js index d02d8fa0253..a8e6195a67c 100644 --- a/spec/javascripts/ide/components/commit_sidebar/actions_spec.js +++ b/spec/javascripts/ide/components/commit_sidebar/actions_spec.js @@ -85,6 +85,13 @@ describe('IDE commit sidebar actions', () => { expect(vm.$store.dispatch).not.toHaveBeenCalled(); }); + it('is not called on mount if there is already a selected commitAction', () => { + store.state.commitAction = '1'; + createComponent({ currentBranchId: null }); + + expect(vm.$store.dispatch).not.toHaveBeenCalled(); + }); + it('calls again after staged changes', done => { createComponent({ currentBranchId: null }); diff --git a/spec/lib/gitlab/ci/reports/test_reports_spec.rb b/spec/lib/gitlab/ci/reports/test_reports_spec.rb index 0b5d05bada3..638acde69eb 100644 --- a/spec/lib/gitlab/ci/reports/test_reports_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_reports_spec.rb @@ -109,6 +109,38 @@ describe Gitlab::Ci::Reports::TestReports do end end + describe '#with_attachment' do + let(:test_case) { build(:test_case, :failed) } + + subject { test_reports.with_attachment! } + + context 'when test suites do not contain an attachment' do + before do + test_reports.get_suite('rspec').add_test_case(create_test_case_rspec_success) + test_reports.get_suite('junit').add_test_case(test_case) + end + + it 'returns empty test suites' do + expect(subject.test_suites).to be_empty + end + end + + context 'when test suites contain an attachment' do + let(:test_case_succes) { build(:test_case) } + let(:test_case_with_attachment) { build(:test_case, :with_attachment) } + + before do + test_reports.get_suite('rspec').add_test_case(test_case_succes) + test_reports.get_suite('junit').add_test_case(test_case_with_attachment) + end + + it 'returns test suites with attachment' do + expect(subject.test_suites.count).to eq(1) + expect(subject.test_suites['junit'].test_cases['failed']).to be_present + end + end + end + Gitlab::Ci::Reports::TestCase::STATUS_TYPES.each do |status_type| describe "##{status_type}_count" do subject { test_reports.public_send("#{status_type}_count") } diff --git a/spec/lib/gitlab/ci/reports/test_suite_spec.rb b/spec/lib/gitlab/ci/reports/test_suite_spec.rb index 217713fd899..9d9774afc82 100644 --- a/spec/lib/gitlab/ci/reports/test_suite_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_suite_spec.rb @@ -85,6 +85,35 @@ describe Gitlab::Ci::Reports::TestSuite do end end + describe '#with_attachment' do + subject { test_suite.with_attachment! } + + context 'when test cases do not contain an attachment' do + let(:test_case) { build(:test_case, :failed)} + + before do + test_suite.add_test_case(test_case) + end + + it 'returns an empty hash' do + expect(subject).to be_empty + end + end + + context 'when test cases contain an attachment' do + let(:test_case_with_attachment) { build(:test_case, :with_attachment)} + + before do + test_suite.add_test_case(test_case_with_attachment) + end + + it 'returns failed test cases with attachment' do + expect(subject.count).to eq(1) + expect(subject['failed']).to be_present + end + end + end + Gitlab::Ci::Reports::TestCase::STATUS_TYPES.each do |status_type| describe "##{status_type}" do subject { test_suite.public_send("#{status_type}") } |