require "rails_helper" RSpec.describe CardsHelper, type: :helper do describe "#card_header" do it "includes a heading element" do header = helper.card_header(text: "Foo") expect(header).to have_css "h1", text: "Foo" end it "includes subtext when present" do header = helper.card_header(subtext: "Bar") expect(header).to have_css "small", text: "Bar" end it "includes close button when present" do header = helper.card_header(close_action_path: "/foo") expect(header).to have_css "a[href='/foo']", text: "Close" end end end