Class: RSpec::GraphqlMatchers::HaveAFieldMatchers::WithHashKey
- Inherits:
-
Object
- Object
- RSpec::GraphqlMatchers::HaveAFieldMatchers::WithHashKey
- Defined in:
- lib/rspec/graphql_matchers/have_a_field_matchers/with_hash_key.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_hash_key) ⇒ WithHashKey
constructor
A new instance of WithHashKey.
- #matches?(actual_field) ⇒ Boolean
Constructor Details
#initialize(expected_hash_key) ⇒ WithHashKey
Returns a new instance of WithHashKey.
5 6 7 |
# File 'lib/rspec/graphql_matchers/have_a_field_matchers/with_hash_key.rb', line 5 def initialize(expected_hash_key) @expected_hash_key = expected_hash_key end |
Instance Method Details
#description ⇒ Object
9 10 11 |
# File 'lib/rspec/graphql_matchers/have_a_field_matchers/with_hash_key.rb', line 9 def description "with hash key `#{@expected_hash_key}`" end |
#failure_message ⇒ Object
18 19 20 |
# File 'lib/rspec/graphql_matchers/have_a_field_matchers/with_hash_key.rb', line 18 def "#{description}, but it was `#{@actual_hash_key}`" end |
#matches?(actual_field) ⇒ Boolean
13 14 15 16 |
# File 'lib/rspec/graphql_matchers/have_a_field_matchers/with_hash_key.rb', line 13 def matches?(actual_field) @actual_hash_key = get_hash_key(actual_field) @actual_hash_key == @expected_hash_key.to_sym end |