Class: RSpec::Wait::Target
- Inherits:
-
Expectations::ExpectationTarget
- Object
- Expectations::ExpectationTarget
- RSpec::Wait::Target
- Defined in:
- lib/rspec/wait/target.rb
Constant Summary collapse
- UndefinedValue =
Module.new
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(target, options) ⇒ Target constructor
- #not_to(matcher = nil, message = nil, &block) ⇒ Object (also: #to_not)
- #to(matcher = nil, message = nil, &block) ⇒ Object
Constructor Details
#initialize(target, options) ⇒ Target
22 23 24 25 |
# File 'lib/rspec/wait/target.rb', line 22 def initialize(target, ) @wait_options = super(target) end |
Class Method Details
.for(value, block, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rspec/wait/target.rb', line 8 def self.for(value, block, = {}) if UndefinedValue.equal?(value) unless block raise ArgumentError, "You must pass either an argument or a block to `wait_for`." end new(block, ) elsif block raise ArgumentError, "You cannot pass both an argument and a block to `wait_for`." else new(value, ) end end |
Instance Method Details
#not_to(matcher = nil, message = nil, &block) ⇒ Object Also known as: to_not
34 35 36 37 |
# File 'lib/rspec/wait/target.rb', line 34 def not_to(matcher = nil, = nil, &block) prevent_operator_matchers(:not_to, matcher) unless matcher with_wait { NegativeHandler.handle_matcher(@target, matcher, , &block) } end |
#to(matcher = nil, message = nil, &block) ⇒ Object
28 29 30 31 |
# File 'lib/rspec/wait/target.rb', line 28 def to(matcher = nil, = nil, &block) prevent_operator_matchers(:to, matcher) unless matcher with_wait { PositiveHandler.handle_matcher(@target, matcher, , &block) } end |