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