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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +4 -3
- data/README.md +23 -6
- data/lib/rspec/graphql_types/version.rb +1 -1
- data/lib/rspec/graphql_types.rb +7 -1
- data/rspec-graphql_types.gemspec +3 -3
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d57da52abe0701765d0a4e82cc715122ea1873b0a338165922dd4cc5850524
|
4
|
+
data.tar.gz: 758b9c0bbeaee55f163da3c37afa82ea39a39895e251b451e81077682eecccd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6998816e11ead713e01ca10677e45f58e101e615b165ccda2c385c079f0348fa9b1949d54bfee287ebab8c2271d685cdc54319f414a0740dd2bf7445dda01028
|
7
|
+
data.tar.gz: 2e724d24dc3e622c1ca98901b3bf33031fab226041053e5327e5234519dd2670bde18e037ebdd06cb91897b6bf39c2e0a87bf005966dfa5183b65734faff8028
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-graphql_types (1.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.
|
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::
|
1
|
+
# Rspec::GraphQLTypes
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
-
|
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
|
|
data/lib/rspec/graphql_types.rb
CHANGED
@@ -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
|
data/rspec-graphql_types.gemspec
CHANGED
@@ -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-
|
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-
|
20
|
-
spec.metadata["changelog_uri"] = "https://github.com/gaia-
|
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.
|
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:
|
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-
|
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-
|
68
|
-
source_code_uri: https://github.com/gaia-
|
69
|
-
changelog_uri: https://github.com/gaia-
|
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.
|
85
|
+
rubygems_version: 3.2.32
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Test out types in ruby graphql
|