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
This commit is contained in:
commit
294310f357
|
@ -507,6 +507,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
||||||
@merge_request.close
|
@merge_request.close
|
||||||
end
|
end
|
||||||
|
|
||||||
|
labels
|
||||||
define_pipelines_vars
|
define_pipelines_vars
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Fix issue causing Labels not to appear in sidebar on MR page
|
||||||
|
merge_request: 7416
|
||||||
|
author: Alex Sanford
|
|
@ -39,6 +39,17 @@ describe Projects::MergeRequestsController do
|
||||||
end
|
end
|
||||||
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
|
describe "GET show" do
|
||||||
shared_examples "export merge as" do |format|
|
shared_examples "export merge as" do |format|
|
||||||
it "does generally work" do
|
it "does generally work" do
|
||||||
|
@ -51,6 +62,8 @@ describe Projects::MergeRequestsController do
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "loads labels", :show
|
||||||
|
|
||||||
it "generates it" do
|
it "generates it" do
|
||||||
expect_any_instance_of(MergeRequest).to receive(:"to_#{format}")
|
expect_any_instance_of(MergeRequest).to receive(:"to_#{format}")
|
||||||
|
|
||||||
|
@ -406,6 +419,8 @@ describe Projects::MergeRequestsController do
|
||||||
get :diffs, params.merge(extra_params)
|
get :diffs, params.merge(extra_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "loads labels", :diffs
|
||||||
|
|
||||||
context 'with default params' do
|
context 'with default params' do
|
||||||
context 'as html' do
|
context 'as html' do
|
||||||
before { go(format: 'html') }
|
before { go(format: 'html') }
|
||||||
|
@ -612,6 +627,8 @@ describe Projects::MergeRequestsController do
|
||||||
format: format
|
format: format
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "loads labels", :commits
|
||||||
|
|
||||||
context 'as html' do
|
context 'as html' do
|
||||||
it 'renders the show template' do
|
it 'renders the show template' do
|
||||||
go
|
go
|
||||||
|
@ -630,6 +647,14 @@ describe Projects::MergeRequestsController do
|
||||||
end
|
end
|
||||||
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
|
describe 'GET conflicts' do
|
||||||
let(:json_response) { JSON.parse(response.body) }
|
let(:json_response) { JSON.parse(response.body) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue