Update plantings#index view spec to use hashes like an ES search result

This commit is contained in:
Brenda Wallace
2019-12-21 16:24:21 +13:00
parent bbaf508da9
commit 44d635e9b3

View File

@@ -15,23 +15,28 @@ describe "plantings/index" do
total_entries = 3 total_entries = 3
plantings = WillPaginate::Collection.create(page, per_page, total_entries) do |pager| plantings = WillPaginate::Collection.create(page, per_page, total_entries) do |pager|
pager.replace([ pager.replace([
FactoryBot.create(:planting, {
garden: garden, 'crop_name' => tomato.name,
crop: tomato, 'slug' => 'tomato-1',
owner: member), 'owner_name' => member.login_name,
FactoryBot.create(:planting, 'owner_slug' => member.slug
garden: garden, },
crop: maize, {
owner: garden.owner, 'crop_name' => maize.name,
description: '', 'slug' => 'maize',
planted_at: Time.zone.local(2013, 1, 13)), 'owner_name' => garden.owner.login_name,
FactoryBot.create(:planting, 'owner_slug' => garden.owner.slug,
garden: garden, 'planted_at' => Time.zone.local(2013, 1, 13)
owner: garden.owner, },
crop: tomato, {
planted_at: Time.zone.local(2013, 1, 13), 'crop_name' => tomato.name,
finished_at: Time.zone.local(2013, 1, 20), 'slug' => 'tomato-2',
finished: true) 'owner_name' => garden.owner.login_name,
'owner_slug' => garden.owner.slug,
'planted_at' => Time.zone.local(2013, 1, 13),
'finished_at' => Time.zone.local(2013, 1, 20),
'finished' => true
}
]) ])
end end
assign(:plantings, plantings) assign(:plantings, plantings)
@@ -39,8 +44,8 @@ describe "plantings/index" do
end end
describe "renders a list of plantings" do describe "renders a list of plantings" do
it { expect(rendered).to have_content tomato.name } it { expect(rendered).to have_content 'tomato' }
it { expect(rendered).to have_content maize.name } it { expect(rendered).to have_content 'maize' }
end end
it "provides data links" do it "provides data links" do