2014-06-17 15:09:01 -04:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2015-05-16 02:33:31 -04:00
|
|
|
expect(project).to receive(:execute_hooks)
|
|
|
|
expect(project).to receive(:execute_services)
|
2014-06-17 15:09:01 -04:00
|
|
|
@note = Notes::CreateService.new(project, user, opts).execute
|
|
|
|
end
|
|
|
|
|
2015-02-12 13:17:35 -05:00
|
|
|
it { expect(@note).to be_valid }
|
|
|
|
it { expect(@note.note).to eq('Awesome comment') }
|
2014-06-17 15:09:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|