diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-06-06 19:48:35 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-06-06 19:48:35 +0300 |
commit | 4d4a9b7c8a62b720e573a2bec67407acc455531a (patch) | |
tree | 2a05d52a8e0c3b13adbe8dbaa8fa33f9faff2e62 /spec/controllers | |
parent | ac4e3e8cf016f2c2b3dcf3997673310a5df658a9 (diff) | |
parent | 8dc1fa0d8dc9106ab95a3039723e9013c4eed00c (diff) |
Merge branch 'notes-are-awardables' into 'master'
Notes are awardables
## What does this MR do?
Makes sure we can :thunder_cloud_rain: comments/notes.
## What are the relevant issue numbers?
Follows up upon !2901, depends on !3785
Closes #3655
## Screenshots (if relevant)
TODO
See merge request !4291
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/notes_controller_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/controllers/projects/notes_controller_spec.rb b/spec/controllers/projects/notes_controller_spec.rb new file mode 100644 index 00000000000..00bc38b6071 --- /dev/null +++ b/spec/controllers/projects/notes_controller_spec.rb @@ -0,0 +1,36 @@ +require('spec_helper') + +describe Projects::NotesController do + let(:user) { create(:user) } + let(:project) { create(:project) } + let(:issue) { create(:issue, project: project) } + let(:note) { create(:note, noteable: issue, project: project) } + + describe 'POST #toggle_award_emoji' do + before do + sign_in(user) + project.team << [user, :developer] + end + + it "toggles the award emoji" do + expect do + post(:toggle_award_emoji, namespace_id: project.namespace.path, + project_id: project.path, id: note.id, name: "thumbsup") + end.to change { note.award_emoji.count }.by(1) + + expect(response.status).to eq(200) + end + + it "removes the already awarded emoji" do + post(:toggle_award_emoji, namespace_id: project.namespace.path, + project_id: project.path, id: note.id, name: "thumbsup") + + expect do + post(:toggle_award_emoji, namespace_id: project.namespace.path, + project_id: project.path, id: note.id, name: "thumbsup") + end.to change { AwardEmoji.count }.by(-1) + + expect(response.status).to eq(200) + end + end +end |