Skip to content

Commit

Permalink
Refactor base spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalina-Vakulchyk committed Mar 26, 2021
1 parent 235f77b commit 43fb72b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions spec/chewy/fields/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,21 @@
end

let(:country_with_cities) do
cities = [City.create!(id: 1, name: '', surname: '', description: ''), City.create!(id: 2, name: '', surname: '', description: '')]
cities = [
City.create!(id: 1, name: '', surname: '', description: ''),
City.create!(id: 2, name: '', surname: '', description: '')
]

Country.create!(id: 1, cities: cities)
end

specify do
expect(CountriesIndex::Country.root.compose(country_with_cities)).to eq('id' => 1, 'cities' => [
{'id' => 1, 'name' => '', 'surname' => ''}, {'id' => 2, 'name' => '', 'surname' => ''}
])
expect(CountriesIndex::Country.root.compose(country_with_cities)).to eq(
'id' => 1, 'cities' => [
{'id' => 1, 'name' => '', 'surname' => ''},
{'id' => 2, 'name' => '', 'surname' => ''}
]
)
end
end

Expand Down Expand Up @@ -516,13 +522,6 @@
end
end

let(:country_with_cities) do
location = Location.create!(lat: '1', lon: '1')
cities = [City.create!(id: 1, name: 'City1'), City.create!(id: 2, name: 'City2')]

Country.create!(id: 1, cities: cities)
end

specify do
expect(CountriesIndex::Country.root.compose(
'id' => 1, 'cities' => [
Expand Down

0 comments on commit 43fb72b

Please sign in to comment.