Sha256: 83225388249a6b417c5b35452987800cd93bf01f943f01f0d9ef6a694bd760e5

Contents?: true

Size: 457 Bytes

Versions: 10

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::FLOAT_TYPE do
  describe "coerce_input" do
    it "accepts ints and floats" do
      assert_equal 1.0, GraphQL::FLOAT_TYPE.coerce_input(1)
      assert_equal 6.1, GraphQL::FLOAT_TYPE.coerce_input(6.1)
    end

    it "rejects other types" do
      assert_equal nil, GraphQL::FLOAT_TYPE.coerce_input("55")
      assert_equal nil, GraphQL::FLOAT_TYPE.coerce_input(true)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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