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

Improve specs using subject

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