Files
grecia/spec/components/layout/social_component_spec.rb
taitus 612872ac7a Define and apply matcher :be_rendered
Add this changes to make components specs clear
2021-11-04 10:49:36 +01:00

40 lines
1.0 KiB
Ruby

require "rails_helper"
describe Layout::SocialComponent do
describe "#render?" do
it "renders when a social setting is present" do
Setting["twitter_handle"] = "myhandle"
render_inline Layout::SocialComponent.new
expect(page).to have_css "ul"
end
it "renders when a content block is present" do
Setting["twitter_handle"] = ""
Setting["facebook_handle"] = ""
Setting["youtube_handle"] = ""
Setting["telegram_handle"] = ""
Setting["instagram_handle"] = ""
create(:site_customization_content_block, name: "footer")
render_inline Layout::SocialComponent.new
expect(page).to have_css "ul"
end
it "does not render with no settings present and no content block present" do
Setting["twitter_handle"] = ""
Setting["facebook_handle"] = ""
Setting["youtube_handle"] = ""
Setting["telegram_handle"] = ""
Setting["instagram_handle"] = ""
render_inline Layout::SocialComponent.new
expect(page).not_to be_rendered
end
end
end