mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-20 10:06:04 +10:00
Award Emoji This it first iteration of award emoji feature. We have plan to extend emoji picker by the next release. For now, you can add award by clicking to the emoji picker or posting a regular comment with emoji like "👍" and any other. You can post not only emoji that listed in the emoji picker. See merge request !1825
62 lines
1.5 KiB
Ruby
62 lines
1.5 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Notes::CreateService do
|
|
let(:project) { create(:empty_project) }
|
|
let(:issue) { create(:issue, project: project) }
|
|
let(:user) { create(:user) }
|
|
|
|
describe :execute do
|
|
context "valid params" do
|
|
before do
|
|
project.team << [user, :master]
|
|
opts = {
|
|
note: 'Awesome comment',
|
|
noteable_type: 'Issue',
|
|
noteable_id: issue.id
|
|
}
|
|
|
|
expect(project).to receive(:execute_hooks)
|
|
expect(project).to receive(:execute_services)
|
|
@note = Notes::CreateService.new(project, user, opts).execute
|
|
end
|
|
|
|
it { expect(@note).to be_valid }
|
|
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
|