diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 15:07:43 +0300 |
commit | d10a462fedbd7794a83abdba9b4526600f71de5b (patch) | |
tree | 4dbd21cb89013d9e07b05bac5101cd13585a8be5 /spec/services/issues | |
parent | 13867d66e92c2fd8962a126db4fbdc32891343c9 (diff) |
Add latest changes from gitlab-org/gitlab@masterogolowinski-master-patch-80898
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/import_csv_service_spec.rb | 16 | ||||
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/spec/services/issues/import_csv_service_spec.rb b/spec/services/issues/import_csv_service_spec.rb index 516a1137319..e7370407d4c 100644 --- a/spec/services/issues/import_csv_service_spec.rb +++ b/spec/services/issues/import_csv_service_spec.rb @@ -18,7 +18,9 @@ describe Issues::ImportCsvService do let(:file) { fixture_file_upload('spec/fixtures/banana_sample.gif') } it 'returns invalid file error' do - expect_any_instance_of(Notify).to receive(:import_issues_csv_email) + expect_next_instance_of(Notify) do |instance| + expect(instance).to receive(:import_issues_csv_email) + end expect(subject[:success]).to eq(0) expect(subject[:parse_error]).to eq(true) @@ -29,7 +31,9 @@ describe Issues::ImportCsvService do let(:file) { fixture_file_upload('spec/fixtures/csv_comma.csv') } it 'imports CSV without errors' do - expect_any_instance_of(Notify).to receive(:import_issues_csv_email) + expect_next_instance_of(Notify) do |instance| + expect(instance).to receive(:import_issues_csv_email) + end expect(subject[:success]).to eq(3) expect(subject[:error_lines]).to eq([]) @@ -41,7 +45,9 @@ describe Issues::ImportCsvService do let(:file) { fixture_file_upload('spec/fixtures/csv_tab.csv') } it 'imports CSV with some error rows' do - expect_any_instance_of(Notify).to receive(:import_issues_csv_email) + expect_next_instance_of(Notify) do |instance| + expect(instance).to receive(:import_issues_csv_email) + end expect(subject[:success]).to eq(2) expect(subject[:error_lines]).to eq([3]) @@ -53,7 +59,9 @@ describe Issues::ImportCsvService do let(:file) { fixture_file_upload('spec/fixtures/csv_semicolon.csv') } it 'imports CSV with a blank row' do - expect_any_instance_of(Notify).to receive(:import_issues_csv_email) + expect_next_instance_of(Notify) do |instance| + expect(instance).to receive(:import_issues_csv_email) + end expect(subject[:success]).to eq(3) expect(subject[:error_lines]).to eq([4]) diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index e39af7bbb72..ee809aabac0 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -131,7 +131,9 @@ describe Issues::MoveService do 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) + allow_next_instance_of(WebHookService) do |instance| + allow(instance).to receive(:execute) + end # Ideally, we'd test that `WebHookWorker.jobs.size` increased by 1, # but since the entire spec run takes place in a transaction, we never |