Files
nairobi/spec/features/banners_spec.rb
Javi Martín 307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00

30 lines
991 B
Ruby

require "rails_helper"
describe "Banner" do
scenario "The banner is shown correctly" do
create(:web_section, name: "homepage")
banner = create(:banner, title: "Hello",
description: "Banner description",
target_url: "http://www.url.com",
post_started_at: (Time.current - 4.days),
post_ended_at: (Time.current + 10.days),
background_color: "#FF0000",
font_color: "#FFFFFF")
section = WebSection.where(name: "homepage").last
create(:banner_section, web_section: section, banner_id: banner.id)
visit root_path
within(".banner") do
expect(page).to have_content("Banner description")
expect(find("h2")[:style]).to eq("color:#{banner.font_color};")
expect(find("h3")[:style]).to eq("color:#{banner.font_color};")
end
visit debates_path
expect(page).not_to have_content("Banner description")
end
end