diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-11 22:36:06 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-11 22:36:06 +0300 |
commit | 294310f357532dd18cb8db4bd0e9aa7fb8c3a077 (patch) | |
tree | 1dd18724397cc13d6e972d3542d46c96df61e988 /spec | |
parent | 0e1e42885a792145dafc6aa28165d069b1cb5c03 (diff) | |
parent | 317c3883477c1af3db96fdbd7caeed46ceb67d72 (diff) |
Merge branch '24397-load-labels-on-mr-tabs' into 'master'
Ensure labels are loaded for all "show" methods of MR Controller
Closes #24397
See merge request !7416
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/merge_requests_controller_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index 49127aecc63..1d0750d1719 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -39,6 +39,17 @@ describe Projects::MergeRequestsController do end end + shared_examples "loads labels" do |action| + it "loads labels into the @labels variable" do + get action, + namespace_id: project.namespace.to_param, + project_id: project.to_param, + id: merge_request.iid, + format: 'html' + expect(assigns(:labels)).not_to be_nil + end + end + describe "GET show" do shared_examples "export merge as" do |format| it "does generally work" do @@ -51,6 +62,8 @@ describe Projects::MergeRequestsController do expect(response).to be_success end + it_behaves_like "loads labels", :show + it "generates it" do expect_any_instance_of(MergeRequest).to receive(:"to_#{format}") @@ -406,6 +419,8 @@ describe Projects::MergeRequestsController do get :diffs, params.merge(extra_params) end + it_behaves_like "loads labels", :diffs + context 'with default params' do context 'as html' do before { go(format: 'html') } @@ -612,6 +627,8 @@ describe Projects::MergeRequestsController do format: format end + it_behaves_like "loads labels", :commits + context 'as html' do it 'renders the show template' do go @@ -630,6 +647,14 @@ describe Projects::MergeRequestsController do end end + describe 'GET builds' do + it_behaves_like "loads labels", :builds + end + + describe 'GET pipelines' do + it_behaves_like "loads labels", :pipelines + end + describe 'GET conflicts' do let(:json_response) { JSON.parse(response.body) } |