Sha256: 6ed2b93c7ea62b5a7112c64aaa38784dc39d93ab4f08e81ea72f709a0bf8f32c
Contents?: true
Size: 959 Bytes
Versions: 2
Compression:
Stored size: 959 Bytes
Contents
# frozen_string_literal: true module RSpec # Wraps the target of an expectation. # # @api private module ExpectationTarget # @param undefined_value A sentinel value to be able to tell when the user # did not pass an argument. We can't use `nil` for that because `nil` is a # valid value to pass. # @param value [#object_id, nil] An actual value. # @param block [#call, nil] A code to evaluate. # # @return [Block, Value] The wrapped target of an expectation. def self.call(undefined_value, value, block) if undefined_value.equal?(value) raise ::ArgumentError, "Pass either an argument or a block" unless block Block.new(block) else raise ::ArgumentError, "Can't pass both an argument and a block" if block Value.new(value) end end end end require_relative File.join("expectation_target", "block") require_relative File.join("expectation_target", "value")
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
r_spec-1.0.0.beta5 | lib/r_spec/expectation_target.rb |
r_spec-1.0.0.beta4 | lib/r_spec/expectation_target.rb |