Simplify conditions to render a banner

This commit is contained in:
Javi Martín
2021-01-14 15:22:20 +01:00
parent 957a73f837
commit c3147a1bb6
4 changed files with 22 additions and 12 deletions

View File

@@ -0,0 +1,15 @@
require "rails_helper"
describe Shared::BannerComponent, type: :component do
it "renders given a banner" do
render_inline Shared::BannerComponent.new(create(:banner, title: "Vote now!"))
expect(page.find(".banner")).to have_content "Vote now!"
end
it "does not render anything given nil" do
render_inline Shared::BannerComponent.new(nil)
expect(page).not_to have_css ".banner"
end
end