Sha256: 99ab87e44229039dcfb4ff07c0429c5727bb719c781cd18d93709cde7b24a777

Contents?: true

Size: 1.06 KB

Versions: 25

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe GraphqlDevise::MountMethod::OptionValidators::SkipOnlyValidator do
  describe '#validate!' do
    subject { -> { described_class.new(options: options).validate! } }

    context 'when only `only` key is set' do
      let(:options) { double(:clean_options, only: [:irrelevant], skip: []) }

      it { is_expected.not_to raise_error }
    end

    context 'when only `skip` key is set' do
      let(:options) { double(:clean_options, skip: [:irrelevant], only: []) }

      it { is_expected.not_to raise_error }
    end

    context 'when `skip` and `only` keys are set' do
      let(:options) { double(:clean_options, only: [:irrelevant], skip: [:irrelevant]) }

      it { is_expected.to raise_error(GraphqlDevise::InvalidMountOptionsError, "Can't specify both `skip` and `only` options when mounting the route.") }
    end

    context 'when neither `skip` nor `only are set`' do
      let(:options) { double(:clean_options, skip: [], only: []) }

      it { is_expected.not_to raise_error }
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
graphql_devise-1.4.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.3.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.2.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.1.1 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.1.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.0.1 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-1.0.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.18.2 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.18.1 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.18.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.17.1 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.17.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.16.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.15.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.14.3 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.14.2 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.14.1 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.14.0 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.13.6 spec/services/mount_method/option_validators/skip_only_validator_spec.rb
graphql_devise-0.13.5 spec/services/mount_method/option_validators/skip_only_validator_spec.rb