Sha256: 682a24daf56375d0443b6a307c216ac5fb493c87b963b967fe04740101b1c79c

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

RSpec.describe GraphqlDevise::SchemaPlugin do
  describe '#call' do
    subject(:plugin) { described_class.new(query: query, mutation: mutation, resource_loaders: loaders) }

    let(:query)    { instance_double(GraphQL::Schema::Object) }
    let(:mutation) { instance_double(GraphQL::Schema::Object) }

    context 'when loaders are not provided' do
      let(:loaders) { [] }

      it 'does not fail' do
        expect { plugin }.not_to raise_error
      end
    end

    context 'when a loaders is not an instance of loader' do
      let(:loaders) { ['not a loader instance'] }

      it 'raises an error' do
        expect { plugin }.to raise_error(GraphqlDevise::Error, 'Invalid resource loader instance')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graphql_devise-0.12.3 spec/services/schema_plugin_spec.rb
graphql_devise-0.12.2 spec/services/schema_plugin_spec.rb
graphql_devise-0.12.1 spec/services/schema_plugin_spec.rb
graphql_devise-0.12.0 spec/services/schema_plugin_spec.rb