Fix component specs using "within"

These specs were passing because the `within` method does not work in
components specs. We have to use `page.find` instead.
This commit is contained in:
Javi Martín
2021-01-09 15:47:37 +01:00
parent afda9ab3b7
commit c5a6ee74c4
2 changed files with 8 additions and 8 deletions

View File

@@ -7,10 +7,12 @@ describe Admin::Poll::Officers::OfficersComponent, type: :component do
let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) } let(:component) { Admin::Poll::Officers::OfficersComponent.new(officers) }
it "renders as many rows as officers" do it "renders as many rows as officers" do
within "tbody" do render_inline component
expect(page).to have_css "tr", count: 2
expect(page).to have_css "a", count: 2 tbody = page.find("tbody")
end
expect(tbody).to have_css "tr", count: 2
expect(tbody).to have_css "a", count: 2
end end
it "renders link to destroy for existing officers" do it "renders link to destroy for existing officers" do

View File

@@ -21,10 +21,8 @@ describe SDGManagement::SubnavigationComponent, type: :component do
end end
it "renders given block within active panel" do 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.find(".tabs-panel.is-active")).to have_content("Tab content")
expect(page).to have_content("Tab content")
end
end end
end end