Class: RSpec::Wait::Target

Inherits:
Expectations::ExpectationTarget
  • Object
show all
Defined in:
lib/rspec/wait/target.rb

Overview

The RSpec::Wait::Target class inherits from RSpec’s internal RSpec::Expectations::ExpectationTarget class and allows the inclusion of RSpec::Wait options via RSpec::Wait::Proxy.

Instance Method Summary collapse

Constructor Details

#initialize(block, options = {}) ⇒ Target



10
11
12
13
# File 'lib/rspec/wait/target.rb', line 10

def initialize(block, options = {})
  @wait_options = options
  super(block)
end

Instance Method Details

#not_to(matcher = nil, message = nil, &block) ⇒ Object Also known as: to_not



25
26
27
28
29
30
31
# File 'lib/rspec/wait/target.rb', line 25

def not_to(matcher = nil, message = nil, &block)
  prevent_operator_matchers(:not_to) unless matcher

  with_wait do
    NegativeHandler.handle_matcher(@target, matcher, message, &block)
  end
end

#to(matcher = nil, message = nil, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rspec/wait/target.rb', line 16

def to(matcher = nil, message = nil, &block)
  prevent_operator_matchers(:to) unless matcher

  with_wait do
    PositiveHandler.handle_matcher(@target, matcher, message, &block)
  end
end