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.
113 114 115 |
# File 'lib/capybara/rspec/matchers.rb', line 113 def initialize() @wait_time = Capybara::Query.new().wait end |
Instance Method Details
#failure_message ⇒ Object Also known as: failure_message_for_should
126 127 128 |
# File 'lib/capybara/rspec/matchers.rb', line 126 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
130 131 132 |
# File 'lib/capybara/rspec/matchers.rb', line 130 def "expected #{@window.inspect} not to become closed after #{@wait_time} seconds" end |
#matches?(window) ⇒ Boolean
117 118 119 120 121 122 123 124 |
# File 'lib/capybara/rspec/matchers.rb', line 117 def matches?(window) @window = window start_time = Time.now while window.exists? && (Time.now - start_time) < @wait_time sleep 0.05 end window.closed? end |