khamusa / rspec-graphql_matchers

Collection of rspec matchers to test your graphQL api schema.
MIT License
145 stars 49 forks source link

expected Types::ClassName to respond to `has_a_field?` #25

Closed bitscraps closed 5 years ago

bitscraps commented 5 years ago

I've added the gem in a test block within the Gemfile and rub bundle install.

However when I run the test which is:

require 'rails_helper'

RSpec.describe Types:ClassName, type: :object do
  subject { self.described_class }

  it { is_expected.to have_a_field(:id) }
end

It errors with:

 Failure/Error: it { is_expected.to have_a_field(:id) }
       expected Types::Events::EventType to respond to `has_a_field?

Is there some additional config needed that does not appear in the documentation.

I'm running rspec-graphql_matchers (0.7.1) and graphql (1.9.4)

khamusa commented 5 years ago

Hi @bitscraps,

how is your gemfile? Are you sure the gem is being loaded in the test env?

khamusa commented 5 years ago

Closing for inactivity