Files
nairobi/spec/system/banners_spec.rb
Javi Martín b93f38ec11 Extract banner test to a component
Checking the `style` attribute fails in JavaScript tests because the
browser converts colors to the `rgb()` format.

So we're testing the generated HTML in a component test while
simplifying the system test.
2021-04-07 14:32:49 +02:00

20 lines
535 B
Ruby

require "rails_helper"
describe "Banner" do
scenario "Only renders banners in the right section" do
create(:banner,
web_sections: [WebSection.find_by!(name: "homepage")],
description: "Banner description",
post_started_at: (Time.current - 4.days),
post_ended_at: (Time.current + 10.days))
visit root_path
within(".banner") { expect(page).to have_content("Banner description") }
visit debates_path
expect(page).not_to have_content("Banner description")
end
end