Sha256: 9c04b32f17fbf4522efc19aebd758c07baa4912f3a4ad96dc71b2c56476980a2

Contents?: true

Size: 514 Bytes

Versions: 10

Compression:

Stored size: 514 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::BOOLEAN_TYPE do
  describe "coerce_input" do
    def coerce_input(input)
      GraphQL::BOOLEAN_TYPE.coerce_input(input)
    end

    it "accepts true and false" do
      assert_equal true, coerce_input(true)
      assert_equal false, coerce_input(false)
    end

    it "rejects other types" do
      assert_equal nil, coerce_input("true")
      assert_equal nil, coerce_input(5.5)
      assert_equal nil, coerce_input(nil)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.5.5 spec/graphql/boolean_type_spec.rb
graphql-1.5.4 spec/graphql/boolean_type_spec.rb
graphql-1.5.3 spec/graphql/boolean_type_spec.rb
graphql-1.4.5 spec/graphql/boolean_type_spec.rb
graphql-1.4.4 spec/graphql/boolean_type_spec.rb
graphql-1.4.3 spec/graphql/boolean_type_spec.rb
graphql-1.4.2 spec/graphql/boolean_type_spec.rb
graphql-1.4.1 spec/graphql/boolean_type_spec.rb
graphql-1.4.0 spec/graphql/boolean_type_spec.rb
graphql-1.3.0 spec/graphql/boolean_type_spec.rb