forked from teamcapybara/capybara
-
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.
Proxy all/within to the correct version based on parameters passed
- Loading branch information
Showing
11 changed files
with
143 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
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,41 @@ | ||
# frozen_string_literal: true | ||
module Capybara | ||
module RSpecMatcherProxies | ||
def all(*args) | ||
if defined?(::RSpec::Matchers::BuiltIn::All) && args.first.respond_to?(:matches?) | ||
::RSpec::Matchers::BuiltIn::All.new(*args) | ||
else | ||
find_all(*args) | ||
end | ||
end | ||
|
||
def within(*args) | ||
if block_given? | ||
within_element(*args, &Proc.new) | ||
else | ||
be_within(*args) | ||
end | ||
end | ||
end | ||
|
||
module DSL | ||
def self.included(base) | ||
warn "including Capybara::DSL in the global scope is not recommended!" if base == Object | ||
|
||
if defined?(::RSpec::Matchers) && base.include?(::RSpec::Matchers) | ||
base.send(:include, ::Capybara::RSpecMatcherProxies) | ||
end | ||
|
||
super | ||
end | ||
end | ||
end | ||
|
||
if defined?(::RSpec::Matchers) | ||
module ::RSpec::Matchers | ||
def self.included(base) | ||
base.send(:include, ::Capybara::RSpecMatcherProxies) if base.include?(::Capybara::DSL) | ||
super | ||
end | ||
end | ||
end |
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 |
---|---|---|
|
@@ -267,4 +267,4 @@ def become_closed(options = {}) | |
BecomeClosed.new(options) | ||
end | ||
end | ||
end | ||
end |
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
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
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
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
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