Ensure labels are loaded on "show" methods of MR
Previously, they were only being loaded on the actual `show` action, but not the actions representing the tabs (commits, builds, etc).
This commit is contained in:
parent
8458f53c69
commit
317c388347
|
@ -507,6 +507,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
|
|||
@merge_request.close
|
||||
end
|
||||
|
||||
labels
|
||||
define_pipelines_vars
|
||||
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
|
||||
|
||||
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) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue