Class: Capybara::RSpecMatchers::HaveCurrentPath
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Attribute Summary collapse
-
#current_path ⇒ Object
readonly
Returns the value of attribute current_path.
-
#failure_message ⇒ Object
(also: #failure_message_for_should)
readonly
Returns the value of attribute failure_message.
-
#failure_message_when_negated ⇒ Object
(also: #failure_message_for_should_not)
readonly
Returns the value of attribute failure_message_when_negated.
Instance Method Summary collapse
- #description ⇒ Object
- #does_not_match?(actual) ⇒ Boolean
-
#initialize(*args) ⇒ HaveCurrentPath
constructor
A new instance of HaveCurrentPath.
- #matches?(actual) ⇒ Boolean
Methods inherited from Matcher
Constructor Details
#initialize(*args) ⇒ HaveCurrentPath
Returns a new instance of HaveCurrentPath.
131 132 133 134 135 136 |
# File 'lib/capybara/rspec/matchers.rb', line 131 def initialize(*args) @args = args # are set just for backwards compatability @current_path = args.first end |
Instance Attribute Details
#current_path ⇒ Object (readonly)
Returns the value of attribute current_path.
127 128 129 |
# File 'lib/capybara/rspec/matchers.rb', line 127 def current_path @current_path end |
#failure_message ⇒ Object (readonly) Also known as: failure_message_for_should
Returns the value of attribute failure_message.
129 130 131 |
# File 'lib/capybara/rspec/matchers.rb', line 129 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly) Also known as: failure_message_for_should_not
Returns the value of attribute failure_message_when_negated.
129 130 131 |
# File 'lib/capybara/rspec/matchers.rb', line 129 def @failure_message_when_negated end |
Instance Method Details
#description ⇒ Object
152 153 154 |
# File 'lib/capybara/rspec/matchers.rb', line 152 def description "have current path #{current_path.inspect}" end |
#does_not_match?(actual) ⇒ Boolean
145 146 147 148 149 150 |
# File 'lib/capybara/rspec/matchers.rb', line 145 def does_not_match?(actual) wrap(actual).assert_no_current_path(*@args) rescue Capybara::ExpectationNotMet => e @failure_message_when_negated = e. return false end |
#matches?(actual) ⇒ Boolean
138 139 140 141 142 143 |
# File 'lib/capybara/rspec/matchers.rb', line 138 def matches?(actual) wrap(actual).assert_current_path(*@args) rescue Capybara::ExpectationNotMet => e @failure_message = e. return false end |