Add spec for MINIMUM_POINTS_IN_CITY = 3

This commit is contained in:
Eugene Burmakin 2024-04-02 23:33:03 +02:00
parent 0afea82aae
commit 904fdaf8be

View file

@ -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