Skip to content

Commit 09c8933

Browse files
committed
Use defined GraphQL::Types::ISO8601DateTime instead of defining similar one
1 parent e6923fd commit 09c8933

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

test/test_query_result.rb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,7 @@
66
require "ostruct"
77
require_relative "foo_helper"
88

9-
class TestQueryResult < Minitest::Test
10-
class DateTimeType < GraphQL::Schema::Scalar
11-
def self.coerce_input(value, ctx)
12-
Time.iso8601(value)
13-
end
14-
15-
def self.coerce_result(value, ctx)
16-
value.utc.iso8601
17-
end
18-
end
19-
9+
class TestQueryResult < MiniTest::Test
2010
module NodeType
2111
include GraphQL::Schema::Interface
2212
field :id, ID, null: false
@@ -58,7 +48,7 @@ class UserType < GraphQL::Schema::Object
5848

5949
module HumanLike
6050
include GraphQL::Schema::Interface
61-
field :updated_at, DateTimeType, null: false
51+
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
6252
end
6353

6454
class PersonType < GraphQL::Schema::Object
@@ -69,7 +59,7 @@ class PersonType < GraphQL::Schema::Object
6959
field :last_name, String, null: true
7060
field :company, String, null: true
7161
field :homepageURL, String, null: true, method: :homepage_url, camelize: false
72-
field :created_at, DateTimeType, null: false
62+
field :created_at, GraphQL::Types::ISO8601DateTime, null: false
7363
field :hobbies, [String], null: true
7464
field :plan, PlanType, null: false
7565
end
@@ -596,7 +586,7 @@ def test_interface_within_union_values
596586
assert_equal Time.at(1).utc, actor.updated_at
597587
end
598588

599-
def test_date_scalar_casting
589+
def test_datetime_scalar_casting
600590
Temp.const_set :Query, @client.parse(<<-'GRAPHQL')
601591
{
602592
me {

0 commit comments

Comments
 (0)