graphql 1.7.5 → 1.7.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f868d29ee9d92da7c21c09227d7e03eec223d7b1
4
- data.tar.gz: 39bfedca6e9089d2b060561d0a4f4e976f606d4e
3
+ metadata.gz: 4ee2881b8335c9299d2dd2b707810856bb34d956
4
+ data.tar.gz: d23544e543addd64583dbcf82280fc92454a515c
5
5
  SHA512:
6
- metadata.gz: b107c9f1f4b0848ba0eb648f9ddc338f2f8cfb000dacaf39e5fc700bf379337bb0cac3b4324af2870d81ad5fb37c5d22346df060a6e88af898abc5e8bac60100
7
- data.tar.gz: 814c342d81382082739b37b207e0172c417bf6ed7052f8f82e6709e3129626b4373f2437785ec137bcf4c288543774871b5d268fca39efc7f0c895e9bed83dfe
6
+ metadata.gz: db14299e06ef27b4f177980705c4f70d6b1d2a6defef6efad0a0b15db493ee1501c820c6fd298a60bc5ffdaf817d50abe4e7c2c145278da5e1ac46866e0a3648
7
+ data.tar.gz: 4776fe2f611c0cb93778fbf6101dfb81a3f08244bce650dccfbc2c999886ac0aac3d26f06533c6722c2e6aceab371ef9aa419f8d9b192301f2674519d5f66848
@@ -12,7 +12,7 @@ module GraphQL
12
12
  module Language
13
13
  class Parser < Racc::Parser
14
14
 
15
- module_eval(<<'...end parser.y/module_eval...', 'parser.y', 373)
15
+ module_eval(<<'...end parser.y/module_eval...', 'parser.y', 372)
16
16
 
17
17
  def initialize(query_string, filename:, tracer: Tracing::NullTracer)
18
18
  @query_string = query_string
@@ -72,7 +72,7 @@ def get_description(token)
72
72
  end
73
73
 
74
74
  def on_error(parser_token_id, lexer_token, vstack)
75
- if lexer_token == "$"
75
+ if lexer_token == "$" || lexer_token == nil
76
76
  raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @query_string, filename: @filename)
77
77
  else
78
78
  parser_token_name = token_to_str(parser_token_id)
@@ -1372,14 +1372,14 @@ module_eval(<<'.,.,', 'parser.y', 226)
1372
1372
  end
1373
1373
  .,.,
1374
1374
 
1375
- module_eval(<<'.,.,', 'parser.y', 229)
1375
+ module_eval(<<'.,.,', 'parser.y', 228)
1376
1376
  def _reduce_99(val, _values, result)
1377
1377
  return make_node(:Enum, name: val[0], position_source: val[0])
1378
1378
  result
1379
1379
  end
1380
1380
  .,.,
1381
1381
 
1382
- module_eval(<<'.,.,', 'parser.y', 232)
1382
+ module_eval(<<'.,.,', 'parser.y', 231)
1383
1383
  def _reduce_100(val, _values, result)
1384
1384
  return []
1385
1385
  result
@@ -1388,35 +1388,35 @@ module_eval(<<'.,.,', 'parser.y', 232)
1388
1388
 
1389
1389
  # reduce 101 omitted
1390
1390
 
1391
- module_eval(<<'.,.,', 'parser.y', 236)
1391
+ module_eval(<<'.,.,', 'parser.y', 235)
1392
1392
  def _reduce_102(val, _values, result)
1393
1393
  return [val[0]]
1394
1394
  result
1395
1395
  end
1396
1396
  .,.,
1397
1397
 
1398
- module_eval(<<'.,.,', 'parser.y', 237)
1398
+ module_eval(<<'.,.,', 'parser.y', 236)
1399
1399
  def _reduce_103(val, _values, result)
1400
1400
  val[0] << val[1]
1401
1401
  result
1402
1402
  end
1403
1403
  .,.,
1404
1404
 
1405
- module_eval(<<'.,.,', 'parser.y', 239)
1405
+ module_eval(<<'.,.,', 'parser.y', 238)
1406
1406
  def _reduce_104(val, _values, result)
1407
1407
  return make_node(:Directive, name: val[1], arguments: val[2], position_source: val[0])
1408
1408
  result
1409
1409
  end
1410
1410
  .,.,
1411
1411
 
1412
- module_eval(<<'.,.,', 'parser.y', 242)
1412
+ module_eval(<<'.,.,', 'parser.y', 241)
1413
1413
  def _reduce_105(val, _values, result)
1414
1414
  return make_node(:FragmentSpread, name: val[1], directives: val[2], position_source: val[0])
1415
1415
  result
1416
1416
  end
1417
1417
  .,.,
1418
1418
 
1419
- module_eval(<<'.,.,', 'parser.y', 246)
1419
+ module_eval(<<'.,.,', 'parser.y', 245)
1420
1420
  def _reduce_106(val, _values, result)
1421
1421
  return make_node(:InlineFragment, {
1422
1422
  type: val[2],
@@ -1429,7 +1429,7 @@ module_eval(<<'.,.,', 'parser.y', 246)
1429
1429
  end
1430
1430
  .,.,
1431
1431
 
1432
- module_eval(<<'.,.,', 'parser.y', 254)
1432
+ module_eval(<<'.,.,', 'parser.y', 253)
1433
1433
  def _reduce_107(val, _values, result)
1434
1434
  return make_node(:InlineFragment, {
1435
1435
  type: nil,
@@ -1442,7 +1442,7 @@ module_eval(<<'.,.,', 'parser.y', 254)
1442
1442
  end
1443
1443
  .,.,
1444
1444
 
1445
- module_eval(<<'.,.,', 'parser.y', 264)
1445
+ module_eval(<<'.,.,', 'parser.y', 263)
1446
1446
  def _reduce_108(val, _values, result)
1447
1447
  return make_node(:FragmentDefinition, {
1448
1448
  name: val[1],
@@ -1457,7 +1457,7 @@ module_eval(<<'.,.,', 'parser.y', 264)
1457
1457
  end
1458
1458
  .,.,
1459
1459
 
1460
- module_eval(<<'.,.,', 'parser.y', 275)
1460
+ module_eval(<<'.,.,', 'parser.y', 274)
1461
1461
  def _reduce_109(val, _values, result)
1462
1462
  return nil
1463
1463
  result
@@ -1472,7 +1472,7 @@ module_eval(<<'.,.,', 'parser.y', 275)
1472
1472
 
1473
1473
  # reduce 113 omitted
1474
1474
 
1475
- module_eval(<<'.,.,', 'parser.y', 284)
1475
+ module_eval(<<'.,.,', 'parser.y', 283)
1476
1476
  def _reduce_114(val, _values, result)
1477
1477
  return make_node(:SchemaDefinition, position_source: val[0], **val[2])
1478
1478
  result
@@ -1481,14 +1481,14 @@ module_eval(<<'.,.,', 'parser.y', 284)
1481
1481
 
1482
1482
  # reduce 115 omitted
1483
1483
 
1484
- module_eval(<<'.,.,', 'parser.y', 288)
1484
+ module_eval(<<'.,.,', 'parser.y', 287)
1485
1485
  def _reduce_116(val, _values, result)
1486
1486
  return val[0].merge(val[1])
1487
1487
  result
1488
1488
  end
1489
1489
  .,.,
1490
1490
 
1491
- module_eval(<<'.,.,', 'parser.y', 291)
1491
+ module_eval(<<'.,.,', 'parser.y', 290)
1492
1492
  def _reduce_117(val, _values, result)
1493
1493
  return { val[0].to_s.to_sym => val[2] }
1494
1494
  result
@@ -1507,14 +1507,14 @@ module_eval(<<'.,.,', 'parser.y', 291)
1507
1507
 
1508
1508
  # reduce 123 omitted
1509
1509
 
1510
- module_eval(<<'.,.,', 'parser.y', 301)
1510
+ module_eval(<<'.,.,', 'parser.y', 300)
1511
1511
  def _reduce_124(val, _values, result)
1512
1512
  return make_node(:ScalarTypeDefinition, name: val[1], directives: val[2], description: get_description(val[0]), position_source: val[0])
1513
1513
  result
1514
1514
  end
1515
1515
  .,.,
1516
1516
 
1517
- module_eval(<<'.,.,', 'parser.y', 305)
1517
+ module_eval(<<'.,.,', 'parser.y', 304)
1518
1518
  def _reduce_125(val, _values, result)
1519
1519
  return make_node(:ObjectTypeDefinition, name: val[1], interfaces: val[2], directives: val[3], fields: val[5], description: get_description(val[0]), position_source: val[0])
1520
1520
 
@@ -1522,21 +1522,21 @@ module_eval(<<'.,.,', 'parser.y', 305)
1522
1522
  end
1523
1523
  .,.,
1524
1524
 
1525
- module_eval(<<'.,.,', 'parser.y', 309)
1525
+ module_eval(<<'.,.,', 'parser.y', 308)
1526
1526
  def _reduce_126(val, _values, result)
1527
1527
  return []
1528
1528
  result
1529
1529
  end
1530
1530
  .,.,
1531
1531
 
1532
- module_eval(<<'.,.,', 'parser.y', 310)
1532
+ module_eval(<<'.,.,', 'parser.y', 309)
1533
1533
  def _reduce_127(val, _values, result)
1534
1534
  return val[1]
1535
1535
  result
1536
1536
  end
1537
1537
  .,.,
1538
1538
 
1539
- module_eval(<<'.,.,', 'parser.y', 314)
1539
+ module_eval(<<'.,.,', 'parser.y', 313)
1540
1540
  def _reduce_128(val, _values, result)
1541
1541
  return make_node(:InputValueDefinition, name: val[0], type: val[2], default_value: val[3], directives: val[4], description: get_description(val[0]))
1542
1542
 
@@ -1544,35 +1544,35 @@ module_eval(<<'.,.,', 'parser.y', 314)
1544
1544
  end
1545
1545
  .,.,
1546
1546
 
1547
- module_eval(<<'.,.,', 'parser.y', 318)
1547
+ module_eval(<<'.,.,', 'parser.y', 317)
1548
1548
  def _reduce_129(val, _values, result)
1549
1549
  return [val[0]]
1550
1550
  result
1551
1551
  end
1552
1552
  .,.,
1553
1553
 
1554
- module_eval(<<'.,.,', 'parser.y', 319)
1554
+ module_eval(<<'.,.,', 'parser.y', 318)
1555
1555
  def _reduce_130(val, _values, result)
1556
1556
  val[0] << val[1]
1557
1557
  result
1558
1558
  end
1559
1559
  .,.,
1560
1560
 
1561
- module_eval(<<'.,.,', 'parser.y', 322)
1561
+ module_eval(<<'.,.,', 'parser.y', 321)
1562
1562
  def _reduce_131(val, _values, result)
1563
1563
  return []
1564
1564
  result
1565
1565
  end
1566
1566
  .,.,
1567
1567
 
1568
- module_eval(<<'.,.,', 'parser.y', 323)
1568
+ module_eval(<<'.,.,', 'parser.y', 322)
1569
1569
  def _reduce_132(val, _values, result)
1570
1570
  return val[1]
1571
1571
  result
1572
1572
  end
1573
1573
  .,.,
1574
1574
 
1575
- module_eval(<<'.,.,', 'parser.y', 327)
1575
+ module_eval(<<'.,.,', 'parser.y', 326)
1576
1576
  def _reduce_133(val, _values, result)
1577
1577
  return make_node(:FieldDefinition, name: val[0], arguments: val[1], type: val[3], directives: val[4], description: get_description(val[0]))
1578
1578
 
@@ -1580,21 +1580,21 @@ module_eval(<<'.,.,', 'parser.y', 327)
1580
1580
  end
1581
1581
  .,.,
1582
1582
 
1583
- module_eval(<<'.,.,', 'parser.y', 331)
1583
+ module_eval(<<'.,.,', 'parser.y', 330)
1584
1584
  def _reduce_134(val, _values, result)
1585
1585
  return [val[0]]
1586
1586
  result
1587
1587
  end
1588
1588
  .,.,
1589
1589
 
1590
- module_eval(<<'.,.,', 'parser.y', 332)
1590
+ module_eval(<<'.,.,', 'parser.y', 331)
1591
1591
  def _reduce_135(val, _values, result)
1592
1592
  val[0] << val[1]
1593
1593
  result
1594
1594
  end
1595
1595
  .,.,
1596
1596
 
1597
- module_eval(<<'.,.,', 'parser.y', 336)
1597
+ module_eval(<<'.,.,', 'parser.y', 335)
1598
1598
  def _reduce_136(val, _values, result)
1599
1599
  return make_node(:InterfaceTypeDefinition, name: val[1], directives: val[2], fields: val[4], description: get_description(val[0]), position_source: val[0])
1600
1600
 
@@ -1602,21 +1602,21 @@ module_eval(<<'.,.,', 'parser.y', 336)
1602
1602
  end
1603
1603
  .,.,
1604
1604
 
1605
- module_eval(<<'.,.,', 'parser.y', 340)
1605
+ module_eval(<<'.,.,', 'parser.y', 339)
1606
1606
  def _reduce_137(val, _values, result)
1607
1607
  return [make_node(:TypeName, name: val[0])]
1608
1608
  result
1609
1609
  end
1610
1610
  .,.,
1611
1611
 
1612
- module_eval(<<'.,.,', 'parser.y', 341)
1612
+ module_eval(<<'.,.,', 'parser.y', 340)
1613
1613
  def _reduce_138(val, _values, result)
1614
1614
  val[0] << make_node(:TypeName, name: val[2])
1615
1615
  result
1616
1616
  end
1617
1617
  .,.,
1618
1618
 
1619
- module_eval(<<'.,.,', 'parser.y', 345)
1619
+ module_eval(<<'.,.,', 'parser.y', 344)
1620
1620
  def _reduce_139(val, _values, result)
1621
1621
  return make_node(:UnionTypeDefinition, name: val[1], directives: val[2], types: val[4], description: get_description(val[0]), position_source: val[0])
1622
1622
 
@@ -1624,7 +1624,7 @@ module_eval(<<'.,.,', 'parser.y', 345)
1624
1624
  end
1625
1625
  .,.,
1626
1626
 
1627
- module_eval(<<'.,.,', 'parser.y', 350)
1627
+ module_eval(<<'.,.,', 'parser.y', 349)
1628
1628
  def _reduce_140(val, _values, result)
1629
1629
  return make_node(:EnumTypeDefinition, name: val[1], directives: val[2], values: val[4], description: get_description(val[0]), position_source: val[0])
1630
1630
 
@@ -1632,7 +1632,7 @@ module_eval(<<'.,.,', 'parser.y', 350)
1632
1632
  end
1633
1633
  .,.,
1634
1634
 
1635
- module_eval(<<'.,.,', 'parser.y', 355)
1635
+ module_eval(<<'.,.,', 'parser.y', 354)
1636
1636
  def _reduce_141(val, _values, result)
1637
1637
  return make_node(:InputObjectTypeDefinition, name: val[1], directives: val[2], fields: val[4], description: get_description(val[0]), position_source: val[0])
1638
1638
 
@@ -1640,7 +1640,7 @@ module_eval(<<'.,.,', 'parser.y', 355)
1640
1640
  end
1641
1641
  .,.,
1642
1642
 
1643
- module_eval(<<'.,.,', 'parser.y', 360)
1643
+ module_eval(<<'.,.,', 'parser.y', 359)
1644
1644
  def _reduce_142(val, _values, result)
1645
1645
  return make_node(:DirectiveDefinition, name: val[2], arguments: val[3], locations: val[5], description: get_description(val[0]), position_source: val[0])
1646
1646
 
@@ -1648,14 +1648,14 @@ module_eval(<<'.,.,', 'parser.y', 360)
1648
1648
  end
1649
1649
  .,.,
1650
1650
 
1651
- module_eval(<<'.,.,', 'parser.y', 364)
1651
+ module_eval(<<'.,.,', 'parser.y', 363)
1652
1652
  def _reduce_143(val, _values, result)
1653
1653
  return [val[0].to_s]
1654
1654
  result
1655
1655
  end
1656
1656
  .,.,
1657
1657
 
1658
- module_eval(<<'.,.,', 'parser.y', 365)
1658
+ module_eval(<<'.,.,', 'parser.y', 364)
1659
1659
  def _reduce_144(val, _values, result)
1660
1660
  val[0] << val[2].to_s
1661
1661
  result
@@ -428,7 +428,7 @@ def get_description(token)
428
428
  end
429
429
 
430
430
  def on_error(parser_token_id, lexer_token, vstack)
431
- if lexer_token == "$"
431
+ if lexer_token == "$" || lexer_token == nil
432
432
  raise GraphQL::ParseError.new("Unexpected end of document", nil, nil, @query_string, filename: @filename)
433
433
  else
434
434
  parser_token_name = token_to_str(parser_token_id)
@@ -1,11 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
  # test_via: ../subscriptions.rb
3
+ require "set"
3
4
  module GraphQL
4
5
  class Subscriptions
5
6
  # Serialization helpers for passing subscription data around.
6
7
  # @api private
7
8
  module Serialize
8
9
  GLOBALID_KEY = "__gid__"
10
+ SYMBOL_KEY = "__sym__"
11
+ SYMBOL_KEYS_KEY = "__sym_keys__"
12
+
9
13
  module_function
10
14
 
11
15
  # @param str [String] A serialized object from {.dump}
@@ -51,8 +55,21 @@ module GraphQL
51
55
  elsif value.is_a?(Hash)
52
56
  if value.size == 1 && value.key?(GLOBALID_KEY)
53
57
  GlobalID::Locator.locate(value[GLOBALID_KEY])
58
+ elsif value.size == 1 && value.key?(SYMBOL_KEY)
59
+ value[SYMBOL_KEY].to_sym
54
60
  else
55
- Hash[value.map{|k, v| [k, load_value(v)]}]
61
+ loaded_h = {}
62
+ sym_keys = value.fetch(SYMBOL_KEYS_KEY, [])
63
+ value.each do |k, v|
64
+ if k == SYMBOL_KEYS_KEY
65
+ next
66
+ end
67
+ if sym_keys.include?(k)
68
+ k = k.to_sym
69
+ end
70
+ loaded_h[k] = load_value(v)
71
+ end
72
+ loaded_h
56
73
  end
57
74
  else
58
75
  value
@@ -65,7 +82,21 @@ module GraphQL
65
82
  if obj.is_a?(Array)
66
83
  obj.map{|item| dump_value(item)}
67
84
  elsif obj.is_a?(Hash)
68
- Hash[obj.map{|k, v| [k, dump_value(v)]}]
85
+ symbol_keys = nil
86
+ dumped_h = {}
87
+ obj.each do |k, v|
88
+ dumped_h[k.to_s] = dump_value(v)
89
+ if k.is_a?(Symbol)
90
+ symbol_keys ||= Set.new
91
+ symbol_keys << k.to_s
92
+ end
93
+ end
94
+ if symbol_keys
95
+ dumped_h[SYMBOL_KEYS_KEY] = symbol_keys.to_a
96
+ end
97
+ dumped_h
98
+ elsif obj.is_a?(Symbol)
99
+ { SYMBOL_KEY => obj.to_s }
69
100
  elsif obj.respond_to?(:to_gid_param)
70
101
  {GLOBALID_KEY => obj.to_gid_param}
71
102
  else
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.7.5"
3
+ VERSION = "1.7.6"
4
4
  end
@@ -787,3 +787,24 @@ GraphqlChannel transmitting {"result"=>{"data"=>{"payload"=>{"value"=>3}}}, "mor
787
787
  Finished "/cable/" [WebSocket] for 127.0.0.1 at 2017-10-08 21:31:14 -0400
788
788
  GraphqlChannel stopped streaming from graphql-subscription:9596f3a8-2ca8-4cc7-af9b-a451c56174ac
789
789
  GraphqlChannel stopped streaming from graphql-event::payload:id:updates-2
790
+ -----------------------------------------------------------
791
+ ActionCableSubscriptionsTest: test_it_handles_subscriptions
792
+ -----------------------------------------------------------
793
+ Started GET "/" for 127.0.0.1 at 2017-11-13 21:58:51 -0500
794
+ Processing by PagesController#show as HTML
795
+ Rendering pages/show.html within layouts/application
796
+ Rendered pages/show.html within layouts/application (0.9ms)
797
+ Completed 200 OK in 136ms (Views: 134.7ms)
798
+ Started GET "/assets/application-aca150c4b2db51d5326af18134f6281fbce7e823a372b0337cca65ff41b4a7ea.js" for 127.0.0.1 at 2017-11-13 21:58:51 -0500
799
+ Started GET "/cable" for 127.0.0.1 at 2017-11-13 21:58:51 -0500
800
+ Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2017-11-13 21:58:51 -0500
801
+ Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
802
+ Could not execute command from ({"command"=>"subscribe", "identifier"=>"{\"channel\":\"GraphqlChannel\",\"id\":\"15fb8788afa\"}"}) [SyntaxError - /Users/rmosolgo/code/graphql-ruby/spec/dummy/app/channels/graphql_channel.rb:43: syntax error, unexpected keyword_end
803
+ end
804
+ ^
805
+ /Users/rmosolgo/code/graphql-ruby/spec/dummy/app/channels/graphql_channel.rb:103: syntax error, unexpected end-of-input, expecting keyword_end]: /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
806
+ Could not execute command from ({"command"=>"subscribe", "identifier"=>"{\"channel\":\"GraphqlChannel\",\"id\":\"15fb87828a0\"}"}) [SyntaxError - /Users/rmosolgo/code/graphql-ruby/spec/dummy/app/channels/graphql_channel.rb:43: syntax error, unexpected keyword_end
807
+ end
808
+ ^
809
+ /Users/rmosolgo/code/graphql-ruby/spec/dummy/app/channels/graphql_channel.rb:103: syntax error, unexpected end-of-input, expecting keyword_end]: /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require' | /Users/rmosolgo/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:379:in `block in require_or_load'
810
+ Finished "/cable/" [WebSocket] for 127.0.0.1 at 2017-11-13 21:58:53 -0500
@@ -0,0 +1 @@
1
+ "%A��G �{h t�l�m�V���NE���f���
@@ -130,7 +130,7 @@ describe GraphQL::EnumType do
130
130
  it "raises an exception when adding a duplicate enum value name" do
131
131
  expected_message = "Enum value names must be unique. Value `COW` already exists on Enum `DairyAnimal`."
132
132
 
133
- exception = assert_raises do
133
+ exception = assert_raises(RuntimeError) do
134
134
  enum.add_value(GraphQL::EnumType::EnumValue.define(name: "COW"))
135
135
  end
136
136
 
@@ -70,8 +70,8 @@ describe GraphQL::Relay::Mutation do
70
70
 
71
71
  schema = GraphQL::Schema.define { mutation(root) }
72
72
 
73
- exception = assert_raises do
74
- puts schema.execute('mutation { bad(input: { input: "graphql" }) { return } }')
73
+ exception = assert_raises(StandardError) do
74
+ schema.execute('mutation { bad(input: { input: "graphql" }) { return } }')
75
75
  end
76
76
 
77
77
  expected_message = "Expected `my_bad_return_value` to be a Hash."\
@@ -24,13 +24,21 @@ if defined?(GlobalID)
24
24
  end
25
25
 
26
26
  describe GraphQL::Subscriptions::Serialize do
27
+ def serialize_dump(v)
28
+ GraphQL::Subscriptions::Serialize.dump(v)
29
+ end
30
+
31
+ def serialize_load(v)
32
+ GraphQL::Subscriptions::Serialize.load(v)
33
+ end
34
+
27
35
  if defined?(GlobalID)
28
36
  it "should serialize GlobalID::Identification in Array/Hash" do
29
37
  user_a = GlobalIDUser.new("a")
30
38
  user_b = GlobalIDUser.new("b")
31
39
 
32
- str_a = GraphQL::Subscriptions::Serialize.dump(["first", 2, user_a])
33
- str_b = GraphQL::Subscriptions::Serialize.dump({first: 'first', second: 2, user: user_b})
40
+ str_a = serialize_dump(["first", 2, user_a])
41
+ str_b = serialize_dump({"first" => 'first', "second" => 2, "user" => user_b})
34
42
 
35
43
  assert_equal str_a, '["first",2,{"__gid__":"Z2lkOi8vZ3JhcGhxbC1ydWJ5LXRlc3QvR2xvYmFsSURVc2VyL2E"}]'
36
44
  assert_equal str_b, '{"first":"first","second":2,"user":{"__gid__":"Z2lkOi8vZ3JhcGhxbC1ydWJ5LXRlc3QvR2xvYmFsSURVc2VyL2I"}}'
@@ -43,11 +51,21 @@ describe GraphQL::Subscriptions::Serialize do
43
51
  str_a = '["first",2,{"__gid__":"Z2lkOi8vZ3JhcGhxbC1ydWJ5LXRlc3QvR2xvYmFsSURVc2VyL2E"}]'
44
52
  str_b = '{"first":"first","second":2,"user":{"__gid__":"Z2lkOi8vZ3JhcGhxbC1ydWJ5LXRlc3QvR2xvYmFsSURVc2VyL2I"}}'
45
53
 
46
- parsed_obj_a = GraphQL::Subscriptions::Serialize.load(str_a)
47
- parsed_obj_b = GraphQL::Subscriptions::Serialize.load(str_b)
54
+ parsed_obj_a = serialize_load(str_a)
55
+ parsed_obj_b = serialize_load(str_b)
48
56
 
49
57
  assert_equal parsed_obj_a, ["first", 2, user_a]
50
58
  assert_equal parsed_obj_b, {'first' => 'first', 'second' => 2, 'user' => user_b}
51
59
  end
52
60
  end
61
+
62
+ it "can deserialize symbols" do
63
+ value = { a: :a, "b" => 2 }
64
+
65
+ dumped = serialize_dump(value)
66
+ expected_dumped = '{"a":{"__sym__":"a"},"b":2,"__sym_keys__":["a"]}'
67
+ assert_equal expected_dumped, dumped
68
+ loaded = serialize_load(dumped)
69
+ assert_equal value, loaded
70
+ end
53
71
  end
@@ -76,7 +76,7 @@ module Dummy
76
76
  if sources.include?("YAK")
77
77
  raise NoSuchDairyError.new("No cheeses are made from Yak milk!")
78
78
  else
79
- CHEESES.values.find { |c| sources.include?(c.source) }
79
+ CHEESES.values.find { |cheese| sources.include?(cheese.source) }
80
80
  end
81
81
  }
82
82
  end
@@ -254,7 +254,7 @@ module Dummy
254
254
 
255
255
  def call(obj, args, ctx)
256
256
  id_string = args["id"].to_s # Cheese has Int type, Milk has ID type :(
257
- _id, item = @data.find { |id, item| id.to_s == id_string }
257
+ _id, item = @data.find { |id, _item| id.to_s == id_string }
258
258
  item
259
259
  end
260
260
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5
4
+ version: 1.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -634,6 +634,7 @@ files:
634
634
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/7r/7rgR5Gy_i08FxXwdCvtqSCXSghB7e5EXB2Vox4MQVUg.cache
635
635
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/8Q/8Qz_ptqTPNDlaE2aAVgaFiIBByiF2fhNHKQJFggzJYA.cache
636
636
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/8e/8ezXMOIySx7oyopI2nH1EXfCzPCFHTJiS3q2tvyEZjY.cache
637
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache
637
638
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/99/99m8UCKl4j8IpsVOK8ltLHyNh8Ae0nHw3GBkC34V_co.cache
638
639
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/9a/9abVi8XfoB8pGShaL5_-jzZGJIxKmedpFY0HQ5h24oE.cache
639
640
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/9g/9gsAnrIrurboVInpkI-XlUZdUGmshgVKXpdRCtXUt6U.cache
@@ -728,6 +729,7 @@ files:
728
729
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Ws/WsHB1qkchRYVF4JV0Yqtr-QiyZ26DiLFtKTrCRVc5kI.cache
729
730
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/XD/XDRDiP6A_Qz7pCCfZHYO6Xfob7trS4JQQoX_ByuWnRI.cache
730
731
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xr/XrGClLu5lOe_6gWU_Nm-tCAC6tUCFpoTPwyKLHmrnNw.cache
732
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xu/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache
731
733
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xu/XupuIipXyzmZQIRfy2SfGTCS21Y-sBxWWjFWmnxYllM.cache
732
734
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xx/XxkX9e-7J9By7nLHpwyUoOdUJ78twXYUefvXKie2WkA.cache
733
735
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Yf/YfGn3oqi1Sm1_rHBqpmph8QpfhWTITbEUWS9waD_HKg.cache
@@ -803,6 +805,7 @@ files:
803
805
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/nq/nqz2Ja53LHhXhFb6ChNpDKnBMWNdp17ZtNhrn-9wdR0.cache
804
806
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/oY/oYHos9r6mwOX5jDyDTWjnpRR_SvWe4EX9gAl20Gqj8I.cache
805
807
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/oj/ojlR_0dl68-YErHzTDzB8lO8nKxQzG6x_Axc5oWIeBg.cache
808
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache
806
809
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pG/pGc_RfrP3RwCp5SBabj-nGnfyeSnUp1Ed1ajCG5Yx-A.cache
807
810
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pQ/PQZm6DUZqIXs_3Wo9ISeQRb0vYyB0XG7iGSHr9_TWlc.cache
808
811
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pQ/pQXlqH4DBItuAHNMXGnwQmnzYkwJ2m7kUgKQbdbZM1E.cache
@@ -1099,6 +1102,7 @@ test_files:
1099
1102
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/7r/7rgR5Gy_i08FxXwdCvtqSCXSghB7e5EXB2Vox4MQVUg.cache
1100
1103
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/8e/8ezXMOIySx7oyopI2nH1EXfCzPCFHTJiS3q2tvyEZjY.cache
1101
1104
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/8Q/8Qz_ptqTPNDlaE2aAVgaFiIBByiF2fhNHKQJFggzJYA.cache
1105
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/8w/8wY_SKagj8wHuwGNAAf6JnQ8joMbC6cEYpHrTAI8Urc.cache
1102
1106
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/99/99m8UCKl4j8IpsVOK8ltLHyNh8Ae0nHw3GBkC34V_co.cache
1103
1107
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/9a/9abVi8XfoB8pGShaL5_-jzZGJIxKmedpFY0HQ5h24oE.cache
1104
1108
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/9g/9gsAnrIrurboVInpkI-XlUZdUGmshgVKXpdRCtXUt6U.cache
@@ -1227,6 +1231,7 @@ test_files:
1227
1231
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/P-/P-STcrlrr_UHY2DAzJOcMU2FOt1STMToqoJ3hYaAEEE.cache
1228
1232
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/PA/PAJgjBwkjHBCPPw8wWUsKsUR7TvgP4RK7PV8-Jdqluw.cache
1229
1233
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/PA/paWxJFaOGYb5g3bPUex7k8lTzXqbJ4F0Uw_zBZI8XxU.cache
1234
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/pE/pE7gO6pQ-z187Swb4hT554wmqsq-cNzgPWLrCz-LQQQ.cache
1230
1235
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pG/pGc_RfrP3RwCp5SBabj-nGnfyeSnUp1Ed1ajCG5Yx-A.cache
1231
1236
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pj/pjg7FTDRmEzqh8W3ijd1Y3GbffQuQwwSKEZ6ftoPnJE.cache
1232
1237
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/pj/pJtdFKizdxA_xBjuuXQWYnEvCcImUQtT5Rh-tGG6v48.cache
@@ -1287,6 +1292,7 @@ test_files:
1287
1292
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/xL/xLktzniI5dkWKAifTMHzZvRHyRHOexsqV-ZRsdLXx0g.cache
1288
1293
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/xL/xLZtF0WWBePfiVBWxxi6brXCLsEfcrj435b9xJupeeU.cache
1289
1294
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xr/XrGClLu5lOe_6gWU_Nm-tCAC6tUCFpoTPwyKLHmrnNw.cache
1295
+ - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xu/XU4k1OXnfMils5SrirorPvDSyDSqiOWLZNtmAH1HH8k.cache
1290
1296
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xu/XupuIipXyzmZQIRfy2SfGTCS21Y-sBxWWjFWmnxYllM.cache
1291
1297
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/xv/xvoydM1zth53tauNTatJNfb-o44mAGDD9-85yRkpeqY.cache
1292
1298
  - spec/dummy/tmp/cache/assets/sprockets/v3.0/Xx/XxkX9e-7J9By7nLHpwyUoOdUJ78twXYUefvXKie2WkA.cache