Commit dd5f441c authored by Nick Thomas's avatar Nick Thomas

Merge branch 'reduce-service-spec-queries' into 'master'

Reduce database manipulation in service spec

See merge request gitlab-org/gitlab!39973
parents ff21e2bb 0d1433bd
......@@ -138,16 +138,16 @@ RSpec.describe Service do
describe '#can_test?' do
subject { service.can_test? }
let(:service) { create(:service, project: project) }
let(:service) { build(:service, project: project) }
context 'when repository is not empty' do
let(:project) { create(:project, :repository) }
let(:project) { build(:project, :repository) }
it { is_expected.to be true }
end
context 'when repository is empty' do
let(:project) { create(:project) }
let(:project) { build(:project) }
it { is_expected.to be true }
end
......@@ -165,10 +165,10 @@ RSpec.describe Service do
describe '#test' do
let(:data) { 'test' }
let(:service) { create(:service, project: project) }
let(:service) { build(:service, project: project) }
context 'when repository is not empty' do
let(:project) { create(:project, :repository) }
let(:project) { build(:project, :repository) }
it 'test runs execute' do
expect(service).to receive(:execute).with(data)
......@@ -178,7 +178,7 @@ RSpec.describe Service do
end
context 'when repository is empty' do
let(:project) { create(:project) }
let(:project) { build(:project) }
it 'test runs execute' do
expect(service).to receive(:execute).with(data)
......@@ -622,8 +622,8 @@ RSpec.describe Service do
end
context 'logging' do
let(:project) { create(:project) }
let(:service) { create(:service, project: project) }
let(:project) { build(:project) }
let(:service) { build(:service, project: project) }
let(:test_message) { "test message" }
let(:arguments) 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