Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanTG committed Oct 12, 2024
1 parent 50cd06e commit cf2fb0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions spec/features/location_machine_conditions_cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
visit "/#{@region.name}/?by_location_id=#{@location.id}&initials=#{@user2.username}"
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('Add machine comment')
expect(page).to have_content('Add high score')

# enter a new condition
page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("div#machine_condition_lmx_#{@lmx.id}.machine_condition_lmx .add_condition").click
fill_in("new_machine_condition_#{@lmx.id}", with: 'This is a new condition2')
page.find("input#save_machine_condition_#{@lmx.id}.save_button").click
page.find("div#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('This is a new condition2')
end

Expand All @@ -81,6 +81,7 @@
visit "/#{@region.name}/?by_location_id=#{@location.id}&initials=#{@user.username}"
sleep 0.5

page.find("div#machine_tools_lmx_banner_#{@lmx.id}").click
page.find("#show_conditions_lmx_banner_#{@lmx.id}").click
expect(page).to have_content('This is a new condition1')
expect(page).to have_content('This is a new condition2')
Expand Down
4 changes: 2 additions & 2 deletions spec/models/location_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@
l = FactoryBot.create(:location)
['Foo', 'Bar', 'Baz', "Beans'"].each { |name| FactoryBot.create(:location_machine_xref, location: l, machine: FactoryBot.create(:machine, name: name)) }

expect(l.content_for_infowindow.chomp).to eq("'<div class=\"infowindow\" id=\"infowindow_#{l.id}\"><div class=\"gm_location_name\">Test Location Name</div><div class=\"gm_address\">303 Southeast 3rd Avenue<br />Portland, OR, 97214<br /></div><hr /><div class=\"gm_machines\" id=\"gm_machines_#{l.id}\">Bar<br />Baz<br />Beans\\'<br />Foo<br /></div></div>'")
expect(l.content_for_infowindow.chomp).to eq("'<div class=\"infowindow\" id=\"infowindow_#{l.id}\"><div class=\"gm_location_name\">Test Location Name</div><div class=\"gm_address\">303 Southeast 3rd Avenue<br />Portland, OR, 97214</div><hr /><div class=\"gm_machines\" id=\"gm_machines_#{l.id}\">Bar<br />Baz<br />Beans\\'<br />Foo<br /></div></div>'")
end
it 'should only list first five machines' do
l = FactoryBot.create(:location)
%w[Foo Bar Baz Beans Sass Cleo].each { |name| FactoryBot.create(:location_machine_xref, location: l, machine: FactoryBot.create(:machine, name: name)) }

expect(l.content_for_infowindow.chomp).to eq("'<div class=\"infowindow\" id=\"infowindow_#{l.id}\"><div class=\"gm_location_name\">Test Location Name</div><div class=\"gm_address\">303 Southeast 3rd Avenue<br />Portland, OR, 97214<br /></div><hr /><div class=\"gm_machines\" id=\"gm_machines_#{l.id}\">Bar<br />Baz<br />Beans<br />Cleo<br />Foo<br /><div>... and 1 more</div></div></div>'")
expect(l.content_for_infowindow.chomp).to eq("'<div class=\"infowindow\" id=\"infowindow_#{l.id}\"><div class=\"gm_location_name\">Test Location Name</div><div class=\"gm_address\">303 Southeast 3rd Avenue<br />Portland, OR, 97214</div><hr /><div class=\"gm_machines\" id=\"gm_machines_#{l.id}\">Bar<br />Baz<br />Beans<br />Cleo<br />Foo<br /><div>... and 1 more</div></div></div>'")
end
end

Expand Down

0 comments on commit cf2fb0e

Please sign in to comment.