Class: RSpec::JsonMatchers::Expectations::Core::SingleValueCallableExpectation Abstract

Inherits:
CallableExpectation show all
Defined in:
lib/rspec/json_matchers/expectations/core.rb

Overview

This class is abstract.

Validates exactly one value is passed in

Class Method Summary collapse

Methods inherited from RSpec::JsonMatchers::Expectation

build, build_many, #expect?

Class Method Details

.[](*values) ⇒ Expectation

The replacement of new It accept any number of arguments and delegates to private new This pattern is taken from gem contracts

But only 1 argument is accepted

Returns:

See Also:



72
73
74
75
76
77
78
79
80
# File 'lib/rspec/json_matchers/expectations/core.rb', line 72

def self.[](*values)
  unless values.size == EXPECTED_VALUE_SIZE
    fail(
      ArgumentError,
      "Exactly #{EXPECTED_VALUE_SIZE} argument is required",
    )
  end
  super
end