forked from pinballmap/pbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for pintips, kineticist links and backglass images
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,6 +383,60 @@ | |
end | ||
end | ||
|
||
describe 'external links', type: :feature, js: true do | ||
before(:each) do | ||
machine_links = FactoryBot.create(:machine, name: 'Twilight Zone', id: 1, opdb_id: 666, kineticist_url: 'website.url') | ||
machine_nolinks = FactoryBot.create(:machine, name: 'Hammer Time', id: 2) | ||
|
||
@machine_links_lmx = FactoryBot.create(:location_machine_xref, location: @location, machine: machine_links, id: 11) | ||
@machine_nolinks_lmx = FactoryBot.create(:location_machine_xref, location: @location, machine: machine_nolinks, id: 12) | ||
end | ||
|
||
it 'should show a pintips link if machine has opdb_id and kineticist link if machine has kineticist_url' do | ||
visit "/#{@region.name}/?by_location_id=#{@location.id}" | ||
|
||
page.find("div#machine_tools_lmx_banner_#{@machine_links_lmx.id}").click | ||
|
||
expect(page).to have_content('PinTips') | ||
expect(page).to have_content('Kineticist') | ||
end | ||
|
||
it 'should not show a pintips link if machine does not have opdb_id nor kineticist link if machine does not have kineticist_url' do | ||
visit "/#{@region.name}/?by_location_id=#{@location.id}" | ||
|
||
page.find("div#machine_tools_lmx_banner_#{@machine_nolinks_lmx.id}").click | ||
|
||
expect(page).to_not have_content('PinTips') | ||
expect(page).to_not have_content('Kineticist') | ||
end | ||
end | ||
|
||
describe 'backglass images', type: :feature, js: true do | ||
before(:each) do | ||
machine_backglass = FactoryBot.create(:machine, name: 'Twilight Zone', id: 1, opdb_img: '/app/assets/images/favicon/favicon.ico') | ||
machine_nobackglass = FactoryBot.create(:machine, name: 'Hammer Time', id: 2) | ||
|
||
@machine_backglass_lmx = FactoryBot.create(:location_machine_xref, location: @location, machine: machine_backglass, id: 11) | ||
@machine_nobackglass_lmx = FactoryBot.create(:location_machine_xref, location: @location, machine: machine_nobackglass, id: 12) | ||
end | ||
|
||
it 'should show a backglass image if machine has opdb_img' do | ||
visit "/#{@region.name}/?by_location_id=#{@location.id}" | ||
|
||
page.find("div#machine_tools_lmx_banner_#{@machine_backglass_lmx.id}").click | ||
|
||
expect(page).to have_css('.backglass_container') | ||
end | ||
|
||
it 'should not show a backglass image if machine has opdb_img' do | ||
visit "/#{@region.name}/?by_location_id=#{@location.id}" | ||
|
||
page.find("div#machine_tools_lmx_banner_#{@machine_nobackglass_lmx.id}").click | ||
|
||
expect(page).to_not have_css('.backglass_container') | ||
end | ||
end | ||
|
||
describe 'insider connected', type: :feature, js: true do | ||
before(:each) do | ||
@user = FactoryBot.create(:user, id: 11, username: 'ssw', email: '[email protected]') | ||
|