diff options
Diffstat (limited to 'spec/controllers/projects/ci')
-rw-r--r-- | spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb | 74 | ||||
-rw-r--r-- | spec/controllers/projects/ci/lints_controller_spec.rb | 9 |
2 files changed, 44 insertions, 39 deletions
diff --git a/spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb b/spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb index 3c4376909f8..e5bffb7c265 100644 --- a/spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb +++ b/spec/controllers/projects/ci/daily_build_group_report_results_controller_spec.rb @@ -59,12 +59,13 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do expect(response).to have_gitlab_http_status(:ok) expect(response.headers['Content-Type']).to eq('text/csv; charset=utf-8') - expect(csv_response).to eq([ - %w[date group_name coverage], - ['2020-03-09', 'rspec', '79.0'], - ['2020-03-08', 'rspec', '77.0'], - ['2019-12-10', 'karma', '81.0'] - ]) + expect(csv_response).to eq( + [ + %w[date group_name coverage], + ['2020-03-09', 'rspec', '79.0'], + ['2020-03-08', 'rspec', '77.0'], + ['2019-12-10', 'karma', '81.0'] + ]) end context 'when given date range spans more than 90 days' do @@ -72,12 +73,13 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do let(:end_date) { '2020-03-09' } it 'limits the result to 90 days from the given start_date' do - expect(csv_response).to eq([ - %w[date group_name coverage], - ['2020-03-09', 'rspec', '79.0'], - ['2020-03-08', 'rspec', '77.0'], - ['2019-12-10', 'karma', '81.0'] - ]) + expect(csv_response).to eq( + [ + %w[date group_name coverage], + ['2020-03-09', 'rspec', '79.0'], + ['2020-03-08', 'rspec', '77.0'], + ['2019-12-10', 'karma', '81.0'] + ]) end end @@ -89,29 +91,8 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do it 'serves the results in JSON' do expect(response).to have_gitlab_http_status(:ok) - expect(json_response).to eq([ - { - 'group_name' => 'rspec', - 'data' => [ - { 'date' => '2020-03-09', 'coverage' => 79.0 }, - { 'date' => '2020-03-08', 'coverage' => 77.0 } - ] - }, - { - 'group_name' => 'karma', - 'data' => [ - { 'date' => '2019-12-10', 'coverage' => 81.0 } - ] - } - ]) - end - - context 'when given date range spans more than 90 days' do - let(:start_date) { '2019-12-09' } - let(:end_date) { '2020-03-09' } - - it 'limits the result to 90 days from the given start_date' do - expect(json_response).to eq([ + expect(json_response).to eq( + [ { 'group_name' => 'rspec', 'data' => [ @@ -126,6 +107,29 @@ RSpec.describe Projects::Ci::DailyBuildGroupReportResultsController do ] } ]) + end + + context 'when given date range spans more than 90 days' do + let(:start_date) { '2019-12-09' } + let(:end_date) { '2020-03-09' } + + it 'limits the result to 90 days from the given start_date' do + expect(json_response).to eq( + [ + { + 'group_name' => 'rspec', + 'data' => [ + { 'date' => '2020-03-09', 'coverage' => 79.0 }, + { 'date' => '2020-03-08', 'coverage' => 77.0 } + ] + }, + { + 'group_name' => 'karma', + 'data' => [ + { 'date' => '2019-12-10', 'coverage' => 81.0 } + ] + } + ]) end end diff --git a/spec/controllers/projects/ci/lints_controller_spec.rb b/spec/controllers/projects/ci/lints_controller_spec.rb index d778739be38..403f99145fc 100644 --- a/spec/controllers/projects/ci/lints_controller_spec.rb +++ b/spec/controllers/projects/ci/lints_controller_spec.rb @@ -143,10 +143,11 @@ RSpec.describe Projects::Ci::LintsController do it_behaves_like 'returns a successful validation' it 'assigns result with errors' do - expect(parsed_body['errors']).to match_array([ - 'jobs rubocop config should implement a script: or a trigger: keyword', - 'jobs config should contain at least one visible job' - ]) + expect(parsed_body['errors']).to match_array( + [ + 'jobs rubocop config should implement a script: or a trigger: keyword', + 'jobs config should contain at least one visible job' + ]) end context 'with dry_run mode' do |