diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:11:53 +0100 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:11:53 +0100 |
commit | 729391fbfce4dea58478b65c684a24a1bfd125a2 (patch) | |
tree | f9f0d9c391744fed388f99d44e96c908ed7aa1f1 /spec/services/issues | |
parent | 999118f0ec6edabc9e13c089381ad664970a080a (diff) | |
parent | 8af23def1d6450420d06b8de54d23311a978de20 (diff) | |
download | gitlab-ce-729391fbfce4dea58478b65c684a24a1bfd125a2.tar.gz |
Merge commit '8af23def1d6' into object-storage-ee-to-ce-backport
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/close_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 16 | ||||
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index 8897a64a138..47c1ebbeb81 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -4,7 +4,7 @@ describe Issues::CloseService do let(:user) { create(:user) } let(:user2) { create(:user) } let(:guest) { create(:user) } - let(:issue) { create(:issue, assignees: [user2]) } + let(:issue) { create(:issue, assignees: [user2], author: create(:user)) } let(:project) { issue.project } let!(:todo) { create(:todo, :assigned, user: user, project: project, target: issue, author: user2) } diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index dfe9adbbcdc..e91faea00b7 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -179,13 +179,15 @@ describe Issues::MoveService do { system: true, note: 'Some system note' }, { system: false, note: 'Some comment 2' }] end - + let(:award_names) { %w(thumbsup thumbsdown facepalm) } let(:notes_contents) { notes_params.map { |n| n[:note] } } before do note_params = { noteable: old_issue, project: old_project, author: author } - notes_params.each do |note| - create(:note, note_params.merge(note)) + notes_params.each_with_index do |note, index| + new_note = create(:note, note_params.merge(note)) + award_emoji_params = { awardable: new_note, name: award_names[index] } + create(:award_emoji, award_emoji_params) end end @@ -199,6 +201,10 @@ describe Issues::MoveService do expect(all_notes.pluck(:note).first(3)).to eq notes_contents end + it 'creates new emojis for the new notes' do + expect(all_notes.map(&:award_emoji).to_a.flatten.map(&:name)).to eq award_names + end + it 'adds a system note about move after rewritten notes' do expect(system_notes.last.note).to match /^moved from/ end @@ -291,9 +297,11 @@ describe Issues::MoveService do end context 'project issue hooks' do - let(:hook) { create(:project_hook, project: old_project, issues_events: true) } + let!(:hook) { create(:project_hook, project: old_project, issues_events: true) } it 'executes project issue hooks' do + allow_any_instance_of(WebHookService).to receive(:execute) + # Ideally, we'd test that `WebHookWorker.jobs.size` increased by 1, # but since the entire spec run takes place in a transaction, we never # actually get to the `after_commit` hook that queues these jobs. diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index 1cb6f2e097f..41237dd7160 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -13,7 +13,8 @@ describe Issues::UpdateService, :mailer do create(:issue, title: 'Old title', description: "for #{user2.to_reference}", assignee_ids: [user3.id], - project: project) + project: project, + author: create(:user)) end before do |