Sha256: 59e0a9424733bfaa3a710e7eceed50497fc376930b215f8e26da72ff7e679ae7

Contents?: true

Size: 1016 Bytes

Versions: 13

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe GraphqlDevise::MountMethod::OperationSanitizer do
  describe '.call' do
    subject { described_class.call(default: default, only: only, skipped: skipped) }

    let(:op_class1) { Class.new }
    let(:op_class2) { Class.new }
    let(:op_class3) { Class.new }

    context 'when the operations passed are mutations' do
      let(:skipped)  { [] }
      let(:only)     { [] }
      let(:default)  { { operation1: { klass: op_class1 }, operation2: { klass: op_class2 } } }

      context 'when no other option besides default is passed' do
        it { is_expected.to eq(default) }
      end

      context 'when there are only operations' do
        let(:only) { [:operation1] }

        it { is_expected.to eq(operation1: { klass: op_class1 }) }
      end

      context 'when there are skipped operations' do
        let(:skipped) { [:operation2] }

        it { is_expected.to eq(operation1: { klass: op_class1 }) }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
graphql_devise-2.0.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.4.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.3.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.2.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.1.1 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.1.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.0.1 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-1.0.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-0.18.2 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-0.18.1 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-0.18.0 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-0.17.1 spec/services/mount_method/operation_sanitizer_spec.rb
graphql_devise-0.17.0 spec/services/mount_method/operation_sanitizer_spec.rb