Sha256: d8664a09ffd2072b0ffe1f391c70d26a5626a54dc64cc4ea7d5d91e32d6f504c
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
module RSpec module Wait class Target < RSpec::Expectations::ExpectationTarget # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/expectation_target.rb#L22 UndefinedValue = Module.new # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/expectation_target.rb#L30-L41 def self.for(value, block, options = {}) if UndefinedValue.equal?(value) unless block raise ArgumentError, "You must pass either an argument or a block to `wait_for`." end new(block, options) elsif block raise ArgumentError, "You cannot pass both an argument and a block to `wait_for`." else new(value, options) end end # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/expectation_target.rb#L25-L27 def initialize(target, options) @wait_options = options super(target) end # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/expectation_target.rb#L53-L54 def to(matcher = nil, message = nil, &block) prevent_operator_matchers(:to, matcher) unless matcher with_wait { PositiveHandler.handle_matcher(@target, matcher, message, &block) } end # From: https://github.com/rspec/rspec-expectations/blob/v3.0.0/lib/rspec/expectations/expectation_target.rb#L66-L67 def not_to(matcher = nil, message = nil, &block) prevent_operator_matchers(:not_to, matcher) unless matcher with_wait { NegativeHandler.handle_matcher(@target, matcher, message, &block) } end private def with_wait Wait.with_wait(@wait_options) { yield } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-wait-0.0.5 | lib/rspec/wait/target.rb |
rspec-wait-0.0.4 | lib/rspec/wait/target.rb |