rspec-graphql_types 1.0.0 → 1.0.4

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
  SHA256:
3
- metadata.gz: 13acdc430639a586b52778b2435689d3d59ddc0e145eff9e86e6cf28f9ae4a15
4
- data.tar.gz: d6bc6da8db2a638a3aa2bf12728399545c3e98fa78b74baea69b84c5d12063ee
3
+ metadata.gz: 73d57da52abe0701765d0a4e82cc715122ea1873b0a338165922dd4cc5850524
4
+ data.tar.gz: 758b9c0bbeaee55f163da3c37afa82ea39a39895e251b451e81077682eecccd4
5
5
  SHA512:
6
- metadata.gz: a72a30b4ee681da0844ba0df22015b222668bd7d951555f8f47b64e269001b6f75763a222cbba89733ef9e7be70ad51671a319281b2908bc0031e7073433c1db
7
- data.tar.gz: f7740ff407eab2ad0b304a4bb4e779657e8a8332df5144a653566f37d9169d9ca7f4e38f4d80cdc10a95fd1767f3a3889337cce8999c012d053750e7cb2cc5c8
6
+ metadata.gz: 6998816e11ead713e01ca10677e45f58e101e615b165ccda2c385c079f0348fa9b1949d54bfee287ebab8c2271d685cdc54319f414a0740dd2bf7445dda01028
7
+ data.tar.gz: 2e724d24dc3e622c1ca98901b3bf33031fab226041053e5327e5234519dd2670bde18e037ebdd06cb91897b6bf39c2e0a87bf005966dfa5183b65734faff8028
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ rspec-graphql_types.iml
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-graphql_types (1.0.0)
4
+ rspec-graphql_types (1.0.3)
5
5
  activesupport
6
6
  graphql
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (6.1.4)
11
+ activesupport (6.1.4.1)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 1.6, < 2)
14
14
  minitest (>= 5.1)
@@ -16,7 +16,7 @@ GEM
16
16
  zeitwerk (~> 2.3)
17
17
  concurrent-ruby (1.1.9)
18
18
  diff-lcs (1.4.4)
19
- graphql (1.12.14)
19
+ graphql (1.12.16)
20
20
  i18n (1.8.10)
21
21
  concurrent-ruby (~> 1.0)
22
22
  minitest (5.14.4)
@@ -40,6 +40,7 @@ GEM
40
40
 
41
41
  PLATFORMS
42
42
  arm64-darwin-20
43
+ x86_64-darwin-20
43
44
 
44
45
  DEPENDENCIES
45
46
  rake (~> 13.0)
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # Rspec::GraphqlTypes
1
+ # Rspec::GraphQLTypes
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rspec/graphql_types`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This library can be used to unit test GraphQL types from the 'graphql' library.
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'rspec-graphql_types'
10
+ group :development, :test do
11
+ gem 'rspec-graphql_types'
12
+ end
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -22,7 +22,24 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ Add the following to your rails_helper.rb
26
+
27
+ ```ruby
28
+ RSpec.configure do |config|
29
+ config.include Rspec::GraphQLTypes, type: :graphql_type
30
+ end
31
+ ```
32
+
33
+ Then you can write tests as follows
34
+
35
+ ```ruby
36
+ RSpec.describe Types::MyType, type: :graphql_type do
37
+ it "does something awesome" do
38
+ object = graphql_object(Types::MyTypes, {passed: in})
39
+ expect(graphql_field(object, :field_name, arg1: value1, arg2: value2)).to eq("The Result")
40
+ end
41
+ end
42
+ ```
26
43
 
27
44
  ## Development
28
45
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module GraphQLTypes
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.4"
6
6
  end
7
7
  end
@@ -16,6 +16,10 @@ module Rspec
16
16
  def multiplex
17
17
  nil
18
18
  end
19
+
20
+ def warden
21
+ @warden
22
+ end
19
23
  end
20
24
 
21
25
  included do
@@ -36,6 +40,8 @@ module Rspec
36
40
  type.coerce_result(value, context)
37
41
  when 'LIST'
38
42
  value.map { |v| graphql_object(type.of_type, v) }
43
+ when 'ENUM'
44
+ type.coerce_result(value, context)
39
45
  else
40
46
  raise "Unknown type kind #{type.kind.name}"
41
47
  end
@@ -65,7 +71,7 @@ module Rspec
65
71
  end
66
72
 
67
73
  def self.schema_class
68
- schemas = GraphQL::Schema.subclasses
74
+ schemas = GraphQL::Schema.subclasses.filter { |schema| !schema.name.start_with?("GraphQL::") }
69
75
  raise "Could not find valid schema. Please ensure that GraphQL::Schema.subclasses returns a single schema" unless schemas.length == 1
70
76
  schemas.first
71
77
  end
@@ -9,15 +9,15 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["tejas@gja.in"]
10
10
 
11
11
  spec.summary = "Test out types in ruby graphql"
12
- spec.homepage = "https://github.com/gaia-ventures/rspec-graphql_types"
12
+ spec.homepage = "https://github.com/gaia-venture/rspec-graphql_types"
13
13
  spec.license = "MIT"
14
14
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
15
 
16
16
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/gaia-ventures/rspec-graphql_types"
20
- spec.metadata["changelog_uri"] = "https://github.com/gaia-ventures/rspec-graphql_types"
19
+ spec.metadata["source_code_uri"] = "https://github.com/gaia-venture/rspec-graphql_types"
20
+ spec.metadata["changelog_uri"] = "https://github.com/gaia-venture/rspec-graphql_types"
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-graphql_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tejas Dinkar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-27 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -59,14 +59,14 @@ files:
59
59
  - lib/rspec/graphql_types.rb
60
60
  - lib/rspec/graphql_types/version.rb
61
61
  - rspec-graphql_types.gemspec
62
- homepage: https://github.com/gaia-ventures/rspec-graphql_types
62
+ homepage: https://github.com/gaia-venture/rspec-graphql_types
63
63
  licenses:
64
64
  - MIT
65
65
  metadata:
66
66
  allowed_push_host: https://rubygems.org
67
- homepage_uri: https://github.com/gaia-ventures/rspec-graphql_types
68
- source_code_uri: https://github.com/gaia-ventures/rspec-graphql_types
69
- changelog_uri: https://github.com/gaia-ventures/rspec-graphql_types
67
+ homepage_uri: https://github.com/gaia-venture/rspec-graphql_types
68
+ source_code_uri: https://github.com/gaia-venture/rspec-graphql_types
69
+ changelog_uri: https://github.com/gaia-venture/rspec-graphql_types
70
70
  post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths:
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 3.2.3
85
+ rubygems_version: 3.2.32
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Test out types in ruby graphql