Skip to content

Commit

Permalink
Add failing test reproducing Issue ViewComponent#1910
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Feb 5, 2024
1 parent 459b4d8 commit 5150235
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/sandbox/spec/components/inline_level3_component_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe InlineLevel3Component do
context "reproduce #1910: issues with #within Matcher" do
it "raises an error if the given locator is not found" do
render_inline(described_class.new)

# Confidence check.
expect(page).to have_css ".level3-component .level2-component .level1-component", text: "Level 1 component"

expect {
within ".does-not-exist-selector" do
expect(page).not_to have_css ".level3-component"
end
}.to raise_error(Capybara::ExpectationNotMet)
end

it "evaluates the given block when the locator is found" do
render_inline(described_class.new)

# Confidence check.
expect(page).to have_css ".level3-component .level2-component .level1-component", text: "Level 1 component"

expect {
within ".level3-component" do
raise "hello"
end
}.to raise_error("hello")
end
end
end

0 comments on commit 5150235

Please sign in to comment.