Commit 7082b2e1 authored by Sean McGivern's avatar Sean McGivern Committed by Rémy Coutable

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
parent 76b91141
......@@ -507,6 +507,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request.close
end
labels
define_pipelines_vars
end
......
---
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}")
......@@ -340,6 +353,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') }
......@@ -546,6 +561,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
......@@ -564,6 +581,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) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment