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.
29 lines
726 B
Ruby
29 lines
726 B
Ruby
require "rails_helper"
|
|
|
|
describe SDG::Goals::HelpPageComponent do
|
|
let(:goals) { SDG::Goal.all }
|
|
let(:component) { SDG::Goals::HelpPageComponent.new(goals) }
|
|
|
|
before do
|
|
Setting["feature.sdg"] = true
|
|
end
|
|
|
|
it "does not render when the feature is disabled" do
|
|
Setting["feature.sdg"] = false
|
|
|
|
render_inline component
|
|
|
|
expect(page.native.inner_html).to be_empty
|
|
end
|
|
|
|
it "renders content when the feature is enabled" do
|
|
render_inline component
|
|
|
|
expect(page).to have_css ".sdg-help-content"
|
|
expect(page).to have_content SDG::Goal[1].title
|
|
expect(page).to have_content SDG::Goal[1].description
|
|
expect(page).to have_css "#help_tabs"
|
|
expect(page).to have_css "#goal_1_tab"
|
|
end
|
|
end
|