In this PR (https://github.com/consul/consul/pull/4683) a new syntax was introduced in the component specs to check that the component was not rendering. It seems interesting to add this syntax to the rest of the cases and thus unify the way we check that a component is not rendering.
40 lines
1.0 KiB
Ruby
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.native.inner_html).to be_empty
|
|
end
|
|
end
|
|
end
|