Class: RSpec::GraphqlMatchers::Implement
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::GraphqlMatchers::Implement
- Defined in:
- lib/rspec/graphql_matchers/implement.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(interfaces) ⇒ Implement
constructor
A new instance of Implement.
- #matches?(graph_object) ⇒ Boolean
Constructor Details
#initialize(interfaces) ⇒ Implement
Returns a new instance of Implement.
6 7 8 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 6 def initialize(interfaces) @expected = interfaces.map {|interface| interface_name(interface) } end |
Instance Method Details
#description ⇒ Object
28 29 30 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 28 def description "implement #{@expected.join(', ')}" end |
#failure_message ⇒ Object
16 17 18 19 20 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 16 def = "expected interfaces: #{@expected.join(', ')}\n" += "actual interfaces: #{@actual.join(', ')}" end |
#failure_message_when_negated ⇒ Object
22 23 24 25 26 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 22 def = "unexpected interfaces: #{@expected.join(', ')}\n" += "actual interfaces: #{@actual.join(', ')}" end |
#matches?(graph_object) ⇒ Boolean
10 11 12 13 14 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 10 def matches?(graph_object) @graph_object = graph_object @actual = actual @expected.all? { |name| @actual.include?(name) } end |