class Shoulda::Matchers::Graphql::Fields::Optional

Public Class Methods

new(field_name) click to toggle source
# File lib/shoulda/matchers/graphql/fields/optional.rb, line 6
def initialize(field_name)
  super
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/graphql/fields/optional.rb, line 18
def description
  super + ", optional"
end
failure_message() click to toggle source
# File lib/shoulda/matchers/graphql/fields/optional.rb, line 14
def failure_message
  "expected #@field_name to be nullable, but it is not nullable."
end
matches?(subject) click to toggle source
# File lib/shoulda/matchers/graphql/fields/optional.rb, line 10
def matches?(subject)
  subject.fields[@field_name].type.class != GraphQL::Schema::NonNull
end