class RSpec::GraphqlMatchers::HaveAFieldMatchers::WithProperty

Public Class Methods

new(expected_property_name) click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_property.rb, line 5
def initialize(expected_property_name)
  @expected_property_name = expected_property_name
end

Public Instance Methods

description() click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_property.rb, line 9
def description
  "resolving with property `#{@expected_property_name}`"
end
failure_message() click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_property.rb, line 18
def failure_message
  "#{description}, but it was `#{@actual_property}`"
end
matches?(actual_field) click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_property.rb, line 13
def matches?(actual_field)
  @actual_property = property(actual_field).to_sym
  @actual_property == @expected_property_name.to_sym
end

Private Instance Methods

property(field) click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_property.rb, line 24
def property(field)
  property = field.property
  property = field.metadata[:type_class].method_sym if property.nil?
  property
end