Commit 2de8b27b authored by Arturo Herrero's avatar Arturo Herrero

Improve specs using subject

parent 189df62e
...@@ -104,22 +104,20 @@ describe Service do ...@@ -104,22 +104,20 @@ describe Service do
describe "Test Button" do describe "Test Button" do
describe '#can_test?' do describe '#can_test?' do
subject { service.can_test? }
let(:service) { create(:service, project: project) } let(:service) { create(:service, project: project) }
context 'when repository is not empty' do context 'when repository is not empty' do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
it 'returns true' do it { is_expected.to be true }
expect(service.can_test?).to be true
end
end end
context 'when repository is empty' do context 'when repository is empty' do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'returns true' do it { is_expected.to be true }
expect(service.can_test?).to be true
end
end end
context 'when instance-level service' do context 'when instance-level service' do
...@@ -128,9 +126,7 @@ describe Service do ...@@ -128,9 +126,7 @@ describe Service do
service_type.constantize.new(instance: true) service_type.constantize.new(instance: true)
end end
it 'returns false' do it { is_expected.to be_falsey }
expect(service.can_test?).to be_falsey
end
end end
end end
end end
......
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