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.
8 9 10 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 8 def initialize(interfaces) @expected = interfaces.map { |interface| interface_name(interface) } end |
Instance Method Details
#description ⇒ Object
30 31 32 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 30 def description "implement #{@expected.join(', ')}" end |
#failure_message ⇒ Object
18 19 20 21 22 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 18 def = "expected interfaces: #{@expected.join(', ')}\n" += "actual interfaces: #{@actual.join(', ')}" end |
#failure_message_when_negated ⇒ Object
24 25 26 27 28 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 24 def = "unexpected interfaces: #{@expected.join(', ')}\n" += "actual interfaces: #{@actual.join(', ')}" end |
#matches?(graph_object) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 12 def matches?(graph_object) @graph_object = graph_object @actual = actual @expected.all? { |name| @actual.include?(name) } end |