Class: RSpec::JsonMatchers::Expectation Abstract
- Inherits:
-
Object
- Object
- RSpec::JsonMatchers::Expectation
- Extended by:
- AbstractClass
- Defined in:
- lib/rspec/json_matchers/expectation.rb
Overview
This class MUST be used after being inherited Subclasses MUST override #expect? to allow this gem to determine the test result
Represents an expectation of an object (usually called expected) Built to avoid Object#=== usage like other matcher gems, like rspec-json_matcher Actually rspec-mocks 3.x also uses it, but only internally
Direct Known Subclasses
RSpec::JsonMatchers::Expectations::Core::CallableExpectation, RSpec::JsonMatchers::Expectations::Core::SingletonExpectation
Defined Under Namespace
Classes: Builder
Class Method Summary collapse
-
.build(value) ⇒ Expectation
private
“Build” an expectation object (not class) depends on
value. -
.build_many(values) ⇒ Array<Expectation>
private
“Build” expectation objects (not classes) depending on
values.
Instance Method Summary collapse
-
#expect?(_value) ⇒ Bool
abstract
Determine the value passed in is “expected” by self or not And return the result.
Class Method Details
.build(value) ⇒ Expectation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
“Build” an expectation object (not class) depends on value
44 45 46 |
# File 'lib/rspec/json_matchers/expectation.rb', line 44 def build(value) Builder.new(value).build end |
.build_many(values) ⇒ Array<Expectation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
“Build” expectation objects (not classes) depending on values
53 54 55 |
# File 'lib/rspec/json_matchers/expectation.rb', line 53 def build_many(values) values.flat_map { |v| build(v) } end |
Instance Method Details
#expect?(_value) ⇒ Bool
This method MUST be overridden to allow this gem to determine the test result
Determine the value passed in is “expected” by self or not And return the result
31 32 33 |
# File 'lib/rspec/json_matchers/expectation.rb', line 31 def expect?(_value) fail NotImplementedError end |