class RSpec::GraphqlMatchers::HaveAFieldMatchers::WithDeprecationReason
Public Class Methods
new(expected_reason)
click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_deprecation_reason.rb, line 7 def initialize(expected_reason) @expected_reason = expected_reason end
Public Instance Methods
description()
click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_deprecation_reason.rb, line 26 def description if @expected_reason.nil? 'with a deprecation reason' else "with deprecation reason `#{@expected_reason}`" end end
failure_message()
click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_deprecation_reason.rb, line 21 def failure_message message = "#{description}, but it was " message + (@actual_reason.nil? ? 'not deprecated' : "`#{@actual_reason}`") end
matches?(actual_field)
click to toggle source
# File lib/rspec/graphql_matchers/have_a_field_matchers/with_deprecation_reason.rb, line 11 def matches?(actual_field) @actual_reason = actual_field.deprecation_reason if @expected_reason.nil? !actual_field.deprecation_reason.nil? else actual_field.deprecation_reason == @expected_reason end end