Commit 3399305f authored by Arturo Herrero's avatar Arturo Herrero

Check methods are called instead of stubing them

parent a1101b05
...@@ -893,16 +893,28 @@ RSpec.describe Service do ...@@ -893,16 +893,28 @@ RSpec.describe Service do
end end
describe '.available_services_names' do describe '.available_services_names' do
before do it 'calls the right methods' do
allow(described_class).to receive(:services_names).and_return(%w[prometheus pushover teamcity]) expect(described_class).to receive(:services_names).and_call_original
allow(described_class).to receive(:dev_services_names).and_return(%w[asana]) expect(described_class).to receive(:dev_services_names).and_call_original
allow(described_class).to receive(:project_specific_services_names).and_return(%w[assembla]) expect(described_class).to receive(:project_specific_services_names).and_call_original
described_class.available_services_names
end end
it 'returns the available services names depending on the filters', :aggregate_failures do it 'does not call project_specific_services_names with include_project_specific false' do
expect(described_class.available_services_names).to eq(%w[asana assembla prometheus pushover teamcity]) expect(described_class).to receive(:services_names).and_call_original
expect(described_class.available_services_names(include_project_specific: false)).to eq(%w[asana prometheus pushover teamcity]) expect(described_class).to receive(:dev_services_names).and_call_original
expect(described_class.available_services_names(include_dev: false)).to eq(%w[assembla prometheus pushover teamcity]) expect(described_class).not_to receive(:project_specific_services_names)
described_class.available_services_names(include_project_specific: false)
end
it 'does not call dev_services_names with include_dev false' do
expect(described_class).to receive(:services_names).and_call_original
expect(described_class).not_to receive(:dev_services_names)
expect(described_class).to receive(:project_specific_services_names).and_call_original
described_class.available_services_names(include_dev: false)
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