diff --git a/spec/components/admin/poll/officers/officers_component_spec.rb b/spec/components/admin/poll/officers/officers_component_spec.rb index 5d8e9a79a..f80fbb026 100644 --- a/spec/components/admin/poll/officers/officers_component_spec.rb +++ b/spec/components/admin/poll/officers/officers_component_spec.rb @@ -7,10 +7,12 @@ describe Admin::Poll::Officers::OfficersComponent, type: :component do let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) } it "renders as many rows as officers" do - within "tbody" do - expect(page).to have_css "tr", count: 2 - expect(page).to have_css "a", count: 2 - end + render_inline component + + tbody = page.find("tbody") + + expect(tbody).to have_css "tr", count: 2 + expect(tbody).to have_css "a", count: 2 end it "renders link to destroy for existing officers" do diff --git a/spec/components/sdg_management/subnavigation_component_spec.rb b/spec/components/sdg_management/subnavigation_component_spec.rb index 11975e549..40f5d9ae0 100644 --- a/spec/components/sdg_management/subnavigation_component_spec.rb +++ b/spec/components/sdg_management/subnavigation_component_spec.rb @@ -21,10 +21,8 @@ describe SDGManagement::SubnavigationComponent, type: :component do end it "renders given block within active panel" do - render_inline component + render_inline(component) { "Tab content" } - within "#goals.tabs-panel.is-active" do - expect(page).to have_content("Tab content") - end + expect(page.find(".tabs-panel.is-active")).to have_content("Tab content") end end