summaryrefslogtreecommitdiff
path: root/spec/helpers/commits_helper_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-21 18:09:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-21 18:09:11 +0000
commit37a492326e7cde47928ee72abcc284ff9cf8f254 (patch)
tree832417ddab170745bca91ec158b70973ba0700af /spec/helpers/commits_helper_spec.rb
parent81884c35b86035f89364db482e4fff91718bb63a (diff)
downloadgitlab-ce-37a492326e7cde47928ee72abcc284ff9cf8f254.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/commits_helper_spec.rb')
-rw-r--r--spec/helpers/commits_helper_spec.rb31
1 files changed, 25 insertions, 6 deletions
diff --git a/spec/helpers/commits_helper_spec.rb b/spec/helpers/commits_helper_spec.rb
index 8a570bf9a90..45485a12574 100644
--- a/spec/helpers/commits_helper_spec.rb
+++ b/spec/helpers/commits_helper_spec.rb
@@ -7,19 +7,38 @@ RSpec.describe CommitsHelper do
context 'when current_user exists' do
before do
allow(helper).to receive(:current_user).and_return(double('User'))
- allow(helper).to receive(:can_collaborate_with_project?).and_return(true)
end
it 'renders a div for Vue' do
- result = helper.revert_commit_link('_commit_', '_path_', pajamas: true)
+ result = helper.revert_commit_link
expect(result).to include('js-revert-commit-trigger')
end
+ end
+
+ context 'when current_user does not exist' do
+ before do
+ allow(helper).to receive(:current_user).and_return(nil)
+ end
+
+ it 'does not render anything' do
+ result = helper.revert_commit_link
- it 'does not render a div for Vue' do
- result = helper.revert_commit_link('_commit_', '_path_')
+ expect(result).to be_nil
+ end
+ end
+ end
+
+ describe '#cherry_pick_commit_link' do
+ context 'when current_user exists' do
+ before do
+ allow(helper).to receive(:current_user).and_return(double('User'))
+ end
+
+ it 'renders a div for Vue' do
+ result = helper.cherry_pick_commit_link
- expect(result).not_to include('js-revert-commit-trigger')
+ expect(result).to include('js-cherry-pick-commit-trigger')
end
end
@@ -29,7 +48,7 @@ RSpec.describe CommitsHelper do
end
it 'does not render anything' do
- result = helper.revert_commit_link(double('Commit'), '_path_')
+ result = helper.cherry_pick_commit_link
expect(result).to be_nil
end