Sha256: 135c8fff465a4acd5d9672b737e562352f89380e4d067eb0a02016baa9853101

Contents?: true

Size: 567 Bytes

Versions: 6

Compression:

Stored size: 567 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::STRING_TYPE do
  let(:string_type) { GraphQL::STRING_TYPE }

  it "is a default scalar" do
    assert_equal(true, string_type.default_scalar?)
  end

  describe "coerce_input" do
    it "accepts strings" do
      assert_equal "str", string_type.coerce_input("str")
    end

    it "doesn't accept other types" do
      assert_equal nil, string_type.coerce_input(100)
      assert_equal nil, string_type.coerce_input(true)
      assert_equal nil, string_type.coerce_input(0.999)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-1.4.5 spec/graphql/string_type_spec.rb
graphql-1.4.4 spec/graphql/string_type_spec.rb
graphql-1.4.3 spec/graphql/string_type_spec.rb
graphql-1.4.2 spec/graphql/string_type_spec.rb
graphql-1.4.1 spec/graphql/string_type_spec.rb
graphql-1.4.0 spec/graphql/string_type_spec.rb