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(interface_names) ⇒ Implement
constructor
A new instance of Implement.
- #matches?(graph_object) ⇒ Boolean
Constructor Details
#initialize(interface_names) ⇒ Implement
Returns a new instance of Implement.
6 7 8 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 6 def initialize(interface_names) @expected = interface_names.map(&:to_s) 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
10 11 12 13 14 15 16 |
# File 'lib/rspec/graphql_matchers/implement.rb', line 10 def matches?(graph_object) @graph_object = graph_object @actual = actual @expected.each do |name| return false unless @actual.include?(name) end end |