summaryrefslogtreecommitdiff
path: root/spec/presenters
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-07-11 11:49:22 -0500
committerClement Ho <ClemMakesApps@gmail.com>2017-07-11 11:49:22 -0500
commit6eeb6384349b19ec21b667a080893e4facd9b591 (patch)
tree3378fe837e41abca68485aa33b93f7b2991aae09 /spec/presenters
parent09193a4fe18044a61021afef1282ec60b81810b1 (diff)
downloadgitlab-ce-6eeb6384349b19ec21b667a080893e4facd9b591.tar.gz
Make commits behind text a link to the target branch commits page
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/merge_request_presenter_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb
index ef12611cff8..ca6c67a6235 100644
--- a/spec/presenters/merge_request_presenter_spec.rb
+++ b/spec/presenters/merge_request_presenter_spec.rb
@@ -317,6 +317,30 @@ describe MergeRequestPresenter do
end
end
+ describe '#target_branch_commits_path' do
+ subject do
+ described_class.new(resource, current_user: user)
+ .target_branch_commits_path
+ end
+
+ context 'when target branch exists' do
+ it 'returns path' do
+ allow(resource).to receive(:target_branch_exists?) { true }
+
+ is_expected
+ .to eq("/#{resource.target_project.full_path}/commits/#{resource.target_branch}")
+ end
+ end
+
+ context 'when target branch does not exists' do
+ it 'returns nil' do
+ allow(resource).to receive(:target_branch_exists?) { false }
+
+ is_expected.to be_nil
+ end
+ end
+ end
+
describe '#target_branch_tree_path' do
subject do
described_class.new(resource, current_user: user)