diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-11-19 14:41:05 +0200 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-11-19 14:41:05 +0200 |
commit | 671a49cfd53230b57acf579a609bab958e066982 (patch) | |
tree | c3fbd7d3cea07cc9c6e66961336d02ee09a70baa /spec/services/notes | |
parent | 23c5473cc0bd9b9034c5671fbea1356b0fb531e5 (diff) | |
download | gitlab-ce-671a49cfd53230b57acf579a609bab958e066982.tar.gz |
added specs
Diffstat (limited to 'spec/services/notes')
-rw-r--r-- | spec/services/notes/create_service_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/services/notes/create_service_spec.rb b/spec/services/notes/create_service_spec.rb index f2ea0805b2f..066461f5a12 100644 --- a/spec/services/notes/create_service_spec.rb +++ b/spec/services/notes/create_service_spec.rb @@ -24,4 +24,38 @@ describe Notes::CreateService do it { expect(@note.note).to eq('Awesome comment') } end end + + describe "award emoji" do + before do + project.team << [user, :master] + end + + it "creates emoji note" do + opts = { + note: ':smile: ', + noteable_type: 'Issue', + noteable_id: issue.id + } + + @note = Notes::CreateService.new(project, user, opts).execute + + expect(@note).to be_valid + expect(@note.note).to eq('smile') + expect(@note.is_award).to be_truthy + end + + it "creates regular note if emoji name is invalid" do + opts = { + note: ':smile: moretext: ', + noteable_type: 'Issue', + noteable_id: issue.id + } + + @note = Notes::CreateService.new(project, user, opts).execute + + expect(@note).to be_valid + expect(@note.note).to eq(opts[:note]) + expect(@note.is_award).to be_falsy + end + end end |