Class: RSpec::JsonMatchers::Expectations::Mixins::BuiltIn::ArrayWithSize
- Inherits:
-
AnyOf
- Object
- RSpec::JsonMatchers::Expectation
- Core::CallableExpectation
- Core::CompositeExpectation
- AnyOf
- RSpec::JsonMatchers::Expectations::Mixins::BuiltIn::ArrayWithSize
- Defined in:
- lib/rspec/json_matchers/expectations/mixins/built_in.rb
Overview
Note:
For behaviour of “and” (which should be a rare case) Combine AllOf & ArrayWithSize Or raise an issue to add support for switching to “and” with another method call
Takes any number of Integer or Range (if not already) Validates ‘value` to be Array And the size matches any value passed in
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Core::CompositeExpectation
Methods inherited from Core::CallableExpectation
Methods inherited from RSpec::JsonMatchers::Expectation
Class Method Details
.build(value) ⇒ Object
Overrides RSpec::JsonMatchers::Expectation.build
174 175 176 177 178 179 180 181 182 |
# File 'lib/rspec/json_matchers/expectations/mixins/built_in.rb', line 174 def build(value) expectation_classes_mappings.fetch(value.class) do -> (_) { fail ArgumentError, <<-ERR } Expected expection(s) to be kind of #{expectation_classes_mappings.keys.inspect} but found #{value.inspect} ERR end.call(value) end |
Instance Method Details
#expect?(value) ⇒ Boolean
192 193 194 195 |
# File 'lib/rspec/json_matchers/expectations/mixins/built_in.rb', line 192 def expect?(value) value.is_a?(Array) && super(value.size) end |