forked from ViewComponent/view_component
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failing test reproducing Issue ViewComponent#1910
- Loading branch information
1 parent
459b4d8
commit 5150235
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
test/sandbox/spec/components/inline_level3_component_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|