From 5f61c6568d2aef519a96cbd303c66a6aa297d6f3 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 5 Jul 2021 12:34:39 +0200 Subject: [PATCH] Fix report specs [SCI-5859] --- spec/controllers/reports_controller_spec.rb | 12 ++++++++---- spec/models/report_spec.rb | 4 ---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/controllers/reports_controller_spec.rb b/spec/controllers/reports_controller_spec.rb index 282871c7f..b44be3020 100644 --- a/spec/controllers/reports_controller_spec.rb +++ b/spec/controllers/reports_controller_spec.rb @@ -26,13 +26,15 @@ describe ReportsController, type: :controller do report: { name: 'test report created', description: 'test description created', settings: Report::DEFAULT_SETTINGS }, - project_content: { experiments: { experiment.id => [my_module1.id] } }, + project_content: { experiments: [{ id: experiment.id, my_module_ids: [my_module1.id] }] }, template_values: [] } end it 'calls create activity service' do expect(Activities::CreateActivityService).to receive(:call) - .with(hash_including(activity_type: :create_report)) + .once.with(hash_including(activity_type: :create_report)).ordered + expect(Activities::CreateActivityService).to receive(:call) + .once.with(hash_including(activity_type: :generate_pdf_report)).ordered action end @@ -51,12 +53,14 @@ describe ReportsController, type: :controller do id: report.id, report: { name: 'test report update', description: 'test description update' }, - project_content: { experiments: { experiment.id => [my_module2.id] } }, + project_content: { experiments: [{ id: experiment.id, my_module_ids: [my_module2.id] }] }, template_values: [] } end it 'calls create activity service' do expect(Activities::CreateActivityService).to receive(:call) - .with(hash_including(activity_type: :edit_report)) + .once.with(hash_including(activity_type: :edit_report)).ordered + expect(Activities::CreateActivityService).to receive(:call) + .once.with(hash_including(activity_type: :generate_pdf_report)).ordered action end diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index b585293c8..52b927a6f 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -44,9 +44,5 @@ describe Report, type: :model do .is_at_least(Constants::NAME_MIN_LENGTH) .is_at_most(Constants::NAME_MAX_LENGTH) end - - it do - expect(report).to validate_uniqueness_of(:name).scoped_to(:user_id, :project_id).case_insensitive - end end end