Module: Capybara::SessionMatchers
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/capybara/session/matchers.rb |
Instance Method Summary
-
#assert_current_path(string, **options) ⇒ true
Asserts that the page has the given path.
-
#assert_no_current_path(string, **options) ⇒ true
Asserts that the page doesn’t have the given path.
-
#has_current_path?(string, **options) ⇒ Boolean
Checks if the page has the given path.
-
#has_no_current_path?(string, **options) ⇒ Boolean
Checks if the page doesn’t have the given path.
- #_verify_current_path(path, filter_block, **options) private
- #make_predicate(options) private
Instance Method Details
#_verify_current_path(path, filter_block, **options) (private)
[ GitHub ]# File 'lib/capybara/session/matchers.rb', line 72
def _verify_current_path(path, filter_block, ** ) query = Capybara::Queries::CurrentPathQuery.new(path, **, &filter_block) document.synchronize(query.wait) do yield(query) end true end
#assert_current_path(string, **options) ⇒ true
#assert_current_path(regexp, **options) ⇒ true
true
#assert_current_path(regexp, **options) ⇒ true
Asserts that the page has the given path. By default, if passed a full url this will compare against the full url, if passed a path only the path+query portion will be compared, if passed a regexp the comparison will depend on the :url
option (path+query by default)
# File 'lib/capybara/session/matchers.rb', line 22
def assert_current_path(path, **, &optional_filter_block) _verify_current_path(path, optional_filter_block, ** ) do |query| raise Capybara::ExpectationNotMet, query. unless query.resolves_for?(self) end end
#assert_no_current_path(string, **options) ⇒ true
#assert_no_current_path(regexp, **options) ⇒ true
true
#assert_no_current_path(regexp, **options) ⇒ true
Asserts that the page doesn’t have the given path. By default, if passed a full url this will compare against the full url, if passed a path only the path+query portion will be compared, if passed a regexp the comparison will depend on the :url
option
# File 'lib/capybara/session/matchers.rb', line 38
def assert_no_current_path(path, **, &optional_filter_block) _verify_current_path(path, optional_filter_block, ** ) do |query| raise Capybara::ExpectationNotMet, query. if query.resolves_for?(self) end end
#has_current_path?(string, **options) ⇒ Boolean
#has_current_path?(regexp, **options) ⇒ Boolean
Boolean
#has_current_path?(regexp, **options) ⇒ Boolean
Checks if the page has the given path. By default, if passed a full url this will compare against the full url, if passed a path only the path+query portion will be compared, if passed a regexp the comparison will depend on the :url
option
# File 'lib/capybara/session/matchers.rb', line 53
def has_current_path?(path, **, &optional_filter_block) make_predicate( ) { assert_current_path(path, **, &optional_filter_block) } end
#has_no_current_path?(string, **options) ⇒ Boolean
#has_no_current_path?(regexp, **options) ⇒ Boolean
Boolean
#has_no_current_path?(regexp, **options) ⇒ Boolean
Checks if the page doesn’t have the given path. By default, if passed a full url this will compare against the full url, if passed a path only the path+query portion will be compared, if passed a regexp the comparison will depend on the :url
option
# File 'lib/capybara/session/matchers.rb', line 66
def has_no_current_path?(path, **, &optional_filter_block) make_predicate( ) { assert_no_current_path(path, **, &optional_filter_block) } end
#make_predicate(options) (private)
[ GitHub ]# File 'lib/capybara/session/matchers.rb', line 80
def make_predicate( ) [:wait] = 0 unless .key?(:wait) || config.predicates_wait yield rescue Capybara::ExpectationNotMet false end