Files
nairobi/spec/system/help_page_spec.rb
Javi Martín 5f92252054 Fix exception using locales with no help images
In commit 905ac48bb we activated exceptions when assets were not found,
in order to detect places where we were trying to load non-existent
images.

We got an exception for that reason: we were loading images based on the
current locale, but for some locales there was no images.

We're now using fallbacks and loading another image when the original
one isn't available.

Note we're copying the English images to images with a generic name for
the case where there's no fallback with an image. We're copying the
files instead of using symbolic links to make sure they can be
overwritten independently in other CONSUL installations.

Also note we're updating the HTML so the section gets the ID instead of
the header. That way the system test is simple.
2021-05-29 15:05:29 +02:00

60 lines
1.4 KiB
Ruby

require "rails_helper"
describe "Help page" do
context "Index" do
scenario "Help menu and page is visible if feature is enabled" do
Setting["feature.help_page"] = true
Setting["org_name"] = "CONSUL"
visit root_path
expect(page).to have_link "Help"
within("#navigation_bar") do
click_link "Help"
end
expect(page).to have_content("CONSUL is a platform for citizen participation")
end
scenario "Help menu and page is hidden if feature is disabled" do
Setting["feature.help_page"] = nil
visit root_path
expect(page).not_to have_link "Help"
end
end
scenario "renders the default image for locales with no images" do
Setting["feature.help_page"] = true
visit help_path(locale: :de)
within("#proposals") { expect(page).to have_css "img" }
end
scenario "renders the SDG help page link when the feature is enabled" do
Setting["feature.help_page"] = true
Setting["feature.sdg"] = true
visit root_path
within("#navigation_bar") do
click_link "Help"
end
expect(page).to have_link "Sustainable Development Goals help", href: sdg_help_path
end
scenario "does not render the SDG help page link when the feature is disabled" do
Setting["feature.sdg"] = nil
visit root_path
within("#navigation_bar") do
click_link "Help"
end
expect(page).not_to have_link "Sustainable Development Goals help"
end
end