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
23 24 25 26 |
# File 'lib/rspec/wait/target.rb', line 23 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 20 |
# File 'lib/rspec/wait/target.rb', line 8 def self.for(value, block, = {}) if UndefinedValue.equal?(value) raise ArgumentError, "You must pass either an argument or a block to `wait_for`." unless block new(block, ) elsif block raise ArgumentError, "You cannot pass both an argument and a block to `wait_for`." else warn "[DEPRECATION] As of rspec-wait version 1.0, " \ "neither wait_for nor wait.for will accept an argument, only a block." new(value, ) end end |
Instance Method Details
#not_to(matcher = nil, message = nil, &block) ⇒ Object Also known as: to_not
37 38 39 40 41 42 |
# File 'lib/rspec/wait/target.rb', line 37 def not_to(matcher = nil, = nil, &block) prevent_operator_matchers(:not_to) unless matcher with_wait do NegativeHandler.handle_matcher(@target, matcher, , &block) end end |
#to(matcher = nil, message = nil, &block) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/rspec/wait/target.rb', line 29 def to(matcher = nil, = nil, &block) prevent_operator_matchers(:to) unless matcher with_wait do PositiveHandler.handle_matcher(@target, matcher, , &block) end end |