Commit 899686aa authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Use `let_it_be` to speed up specs

parent 57757944
......@@ -3,10 +3,10 @@
require 'spec_helper'
RSpec.describe Security::StoreReportsService do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, :public, namespace: group) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :public, namespace: group) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
describe '#execute' do
subject(:execute_service_object) { described_class.new(pipeline).execute }
......@@ -38,7 +38,7 @@ RSpec.describe Security::StoreReportsService do
end
it 'updates the `latest_pipeline_id` attribute of the associated `vulnerability_statistic` record' do
expect { execute_service_object }.to change { project.vulnerability_statistic&.latest_pipeline_id }.from(nil).to(pipeline.id)
expect { execute_service_object }.to change { project.reload.vulnerability_statistic&.latest_pipeline_id }.from(nil).to(pipeline.id)
end
context 'when StoreReportService returns an error for a report' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment