We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
29 lines
990 B
Ruby
29 lines
990 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
|