summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-05-02 14:38:28 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-05-02 14:38:28 +0000
commitd32ecb23eb10065b1cc5eea95f4271ef402f0059 (patch)
tree0a741d5611f6b591710e58193d8a66ceb68bb338 /spec/helpers
parentac3796b3d3b0e0ceaeceabd3d5783da60f673779 (diff)
parent8c3a03c1b9bf5c80571c9dc07ba258fa10dd61c8 (diff)
downloadgitlab-ce-d32ecb23eb10065b1cc5eea95f4271ef402f0059.tar.gz
Merge branch '12910-personal-snippets-notes-show' into 'master'
Display comments for personal snippets See merge request !10974
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/award_emoji_helper_spec.rb61
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/helpers/award_emoji_helper_spec.rb b/spec/helpers/award_emoji_helper_spec.rb
new file mode 100644
index 00000000000..7dfd6a3f6b4
--- /dev/null
+++ b/spec/helpers/award_emoji_helper_spec.rb
@@ -0,0 +1,61 @@
+require 'spec_helper'
+
+describe AwardEmojiHelper do
+ describe '.toggle_award_url' do
+ context 'note on personal snippet' do
+ let(:note) { create(:note_on_personal_snippet) }
+
+ it 'returns correct url' do
+ expected_url = "/snippets/#{note.noteable.id}/notes/#{note.id}/toggle_award_emoji"
+
+ expect(helper.toggle_award_url(note)).to eq(expected_url)
+ end
+ end
+
+ context 'note on project item' do
+ let(:note) { create(:note_on_project_snippet) }
+
+ it 'returns correct url' do
+ @project = note.noteable.project
+
+ expected_url = "/#{@project.namespace.path}/#{@project.path}/notes/#{note.id}/toggle_award_emoji"
+
+ expect(helper.toggle_award_url(note)).to eq(expected_url)
+ end
+ end
+
+ context 'personal snippet' do
+ let(:snippet) { create(:personal_snippet) }
+
+ it 'returns correct url' do
+ expected_url = "/snippets/#{snippet.id}/toggle_award_emoji"
+
+ expect(helper.toggle_award_url(snippet)).to eq(expected_url)
+ end
+ end
+
+ context 'merge request' do
+ let(:merge_request) { create(:merge_request) }
+
+ it 'returns correct url' do
+ @project = merge_request.project
+
+ expected_url = "/#{@project.namespace.path}/#{@project.path}/merge_requests/#{merge_request.id}/toggle_award_emoji"
+
+ expect(helper.toggle_award_url(merge_request)).to eq(expected_url)
+ end
+ end
+
+ context 'issue' do
+ let(:issue) { create(:issue) }
+
+ it 'returns correct url' do
+ @project = issue.project
+
+ expected_url = "/#{@project.namespace.path}/#{@project.path}/issues/#{issue.id}/toggle_award_emoji"
+
+ expect(helper.toggle_award_url(issue)).to eq(expected_url)
+ end
+ end
+ end
+end