Class: Capybara::RSpecMatchers::BecomeClosed
- Inherits:
-
Object
- Object
- Capybara::RSpecMatchers::BecomeClosed
- Defined in:
- lib/capybara/rspec/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object (also: #failure_message_for_should)
- #failure_message_when_negated ⇒ Object (also: #failure_message_for_should_not)
-
#initialize(options) ⇒ BecomeClosed
constructor
A new instance of BecomeClosed.
- #matches?(window) ⇒ Boolean
Constructor Details
#initialize(options) ⇒ BecomeClosed
Returns a new instance of BecomeClosed.
163 164 165 |
# File 'lib/capybara/rspec/matchers.rb', line 163 def initialize() @wait_time = Capybara::Queries::SelectorQuery.new().wait end |
Instance Method Details
#failure_message ⇒ Object Also known as: failure_message_for_should
177 178 179 |
# File 'lib/capybara/rspec/matchers.rb', line 177 def "expected #{@window.inspect} to become closed after #{@wait_time} seconds" end |
#failure_message_when_negated ⇒ Object Also known as: failure_message_for_should_not
181 182 183 |
# File 'lib/capybara/rspec/matchers.rb', line 181 def "expected #{@window.inspect} not to become closed after #{@wait_time} seconds" end |
#matches?(window) ⇒ Boolean
167 168 169 170 171 172 173 174 175 |
# File 'lib/capybara/rspec/matchers.rb', line 167 def matches?(window) @window = window start_time = Capybara::Helpers.monotonic_time while window.exists? return false if (Capybara::Helpers.monotonic_time - start_time) > @wait_time sleep 0.05 end true end |