diff --git a/spec/services/countries_and_cities_spec.rb b/spec/services/countries_and_cities_spec.rb index 24d8ab3d..194b29ad 100644 --- a/spec/services/countries_and_cities_spec.rb +++ b/spec/services/countries_and_cities_spec.rb @@ -14,17 +14,34 @@ RSpec.describe CountriesAndCities do ] end - before do - stub_const('CountriesAndCities::MINIMUM_POINTS_IN_CITY', 1) + context 'when MINIMUM_POINTS_IN_CITY is 1' do + before do + stub_const('CountriesAndCities::MINIMUM_POINTS_IN_CITY', 1) + end + + it 'returns countries and cities' do + expect(countries_and_cities).to eq( + [ + { cities: [{city: "City", points: 3, timestamp: 1}], country: "Country" }, + { cities: [{city: "Another city", points: 2, timestamp: 1}], country: "Some Country" } + ] + ) + end end - it 'returns countries and cities' do - expect(countries_and_cities).to eq( - [ - { cities: [{city: "City", points: 3, timestamp: 1}], country: "Country" }, - { cities: [{city: "Another city", points: 2, timestamp: 1}], country: "Some Country" } - ] - ) + context 'when MINIMUM_POINTS_IN_CITY is 3' do + before do + stub_const('CountriesAndCities::MINIMUM_POINTS_IN_CITY', 3) + end + + it 'returns countries and cities' do + expect(countries_and_cities).to eq( + [ + { cities: [{city: "City", points: 3, timestamp: 1}], country: "Country" }, + { cities: [], country: "Some Country" } + ] + ) + end end end end