Sha256: c51abf2ccfedfd5250d36c341171337c12cc48b68ab22a2464872fa16a2b056d

Contents?: true

Size: 837 Bytes

Versions: 26

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe GraphQL::InputObjectType do
  describe 'default values' do
    describe 'when the type is an enum with underlying ruby values' do
      it 'provides the default value' do
        TestEnum = GraphQL::EnumType.define do
          name 'Test'

          value 'A', 'Represents an authorized agent in our system.', value: 'a'
          value 'B', 'Agent is disabled, web app access is denied.', value: 'b'
        end

        class TestInput < GraphQL::Schema::InputObject
          argument :foo, TestEnum, 'TestEnum', required: false, default_value: 'a'
        end

        test_input_type = TestInput.to_graphql
        default_test_input_value = test_input_type.coerce_isolated_input({})
        assert_equal default_test_input_value[:foo], 'a'
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/graphql/input_object_type_spec.rb
graphql-1.9.11 spec/graphql/input_object_type_spec.rb
graphql-1.9.10 spec/graphql/input_object_type_spec.rb
graphql-1.9.9 spec/graphql/input_object_type_spec.rb
graphql-1.9.8 spec/graphql/input_object_type_spec.rb
graphql-1.9.7 spec/graphql/input_object_type_spec.rb
graphql-1.9.6 spec/graphql/input_object_type_spec.rb
graphql-1.9.5 spec/graphql/input_object_type_spec.rb
graphql-1.9.4 spec/graphql/input_object_type_spec.rb
graphql-1.9.3 spec/graphql/input_object_type_spec.rb
graphql-1.9.2 spec/graphql/input_object_type_spec.rb
graphql-1.8.17 spec/graphql/input_object_type_spec.rb
graphql-1.8.16 spec/graphql/input_object_type_spec.rb
graphql-1.9.1 spec/graphql/input_object_type_spec.rb
graphql-1.9.0 spec/graphql/input_object_type_spec.rb
graphql-1.8.15 spec/graphql/input_object_type_spec.rb
graphql-1.9.0.pre4 spec/graphql/input_object_type_spec.rb
graphql-1.8.14 spec/graphql/input_object_type_spec.rb
graphql-1.9.0.pre3 spec/graphql/input_object_type_spec.rb
graphql-1.9.0.pre2 spec/graphql/input_object_type_spec.rb