module Shoulda::Matchers::Graphql::Fields
Public Instance Methods
define_field(field_name)
click to toggle source
The 'define_field' matcher is the starting point for field-level validations.
class PostType < GraphQL::Schema::Object field :some_field, String, null: false end #RSpec RSpec.describe PostType do it { should have_field("some_field") } end
## Qualifiers
### `of_type`
Use `of_type` if you want to test the return type of the field
class PostType < GraphQL::Schema::Object field :some_field, String, null: false end #RSpec RSpec.describe PostType do it { should have_field("some_field").of_type(String) } end
# File lib/shoulda/matchers/graphql/fields/define_field.rb, line 32 def define_field(field_name) DefineField.new(field_name) end