artemis 0.7.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +83 -7
- data/Appraisals +9 -0
- data/CHANGELOG.md +19 -2
- data/artemis.gemspec +1 -1
- data/gemfiles/rails_71.gemfile +14 -0
- data/gemfiles/rails_edge.gemfile +1 -0
- data/lib/artemis/adapters/net_http_persistent_adapter.rb +6 -0
- data/lib/artemis/railtie.rb +1 -1
- data/lib/artemis/version.rb +1 -1
- data/spec/adapters_spec.rb +9 -2
- data/spec/autoloading_spec.rb +55 -49
- data/spec/callbacks_spec.rb +6 -6
- data/spec/client_spec.rb +84 -78
- data/spec/endpoint_spec.rb +11 -7
- data/spec/fixtures/github/_repository_fields.graphql +12 -0
- data/spec/fixtures/github/repository.graphql +6 -0
- data/spec/fixtures/github/schema.json +165225 -0
- data/spec/fixtures/github/user.graphql +6 -0
- data/spec/fixtures/github/user_repositories.graphql +13 -0
- data/spec/fixtures/github.rb +2 -0
- data/spec/fixtures/responses/github/repository.yml +17 -0
- data/spec/fixtures/responses/github/user.json +10 -0
- data/spec/spec_helper.rb +3 -3
- data/spec/test_helper_spec.rb +32 -32
- metadata +16 -15
- data/spec/fixtures/metaphysics/_artist_fields.graphql +0 -4
- data/spec/fixtures/metaphysics/artist.graphql +0 -7
- data/spec/fixtures/metaphysics/artists.graphql +0 -8
- data/spec/fixtures/metaphysics/artwork.graphql +0 -8
- data/spec/fixtures/metaphysics/schema.json +0 -49811
- data/spec/fixtures/metaphysics.rb +0 -2
- data/spec/fixtures/responses/metaphysics/artist.yml +0 -24
- data/spec/fixtures/responses/metaphysics/artwork.json +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcf01b2987aaf247cee4afa02982fd582208ea0b48f3042ed207e7bb5ed6fdd8
|
4
|
+
data.tar.gz: 4eea51e39bbe709d579d08a409d09c2a95495590ab99609834d0af735cc0c46a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0f862a4301a613dfe0fadefe9bdbad4170f2b6af1ef6f5db859fb13d40dc0065a1d93d37cab4f44790c90c1b624bf62d4b7777ebaa67e38028be0816d14d19d
|
7
|
+
data.tar.gz: 0b197e80bf6ffe84c489423804d8b67fa18f37c57679015308598284090d5ab9adcdea587a27c6e49312c741642e5fe03675a594e6b66695af08dc344fb76db3
|
data/.github/workflows/ruby.yml
CHANGED
@@ -5,24 +5,34 @@ on:
|
|
5
5
|
- pull_request
|
6
6
|
|
7
7
|
jobs:
|
8
|
-
|
8
|
+
mri:
|
9
9
|
strategy:
|
10
10
|
matrix:
|
11
11
|
ruby_version:
|
12
|
+
- '3.2'
|
12
13
|
- '3.1'
|
13
14
|
- '3.0'
|
14
15
|
- '2.7'
|
15
16
|
- '2.6'
|
16
|
-
# - 'jruby-9.2.17.0'
|
17
17
|
gemfile:
|
18
|
+
- gemfiles/rails_71.gemfile
|
18
19
|
- gemfiles/rails_70.gemfile
|
19
20
|
- gemfiles/rails_61.gemfile
|
20
21
|
- gemfiles/rails_60.gemfile
|
21
22
|
- gemfiles/rails_52.gemfile
|
22
23
|
- gemfiles/rails_51.gemfile
|
23
24
|
- gemfiles/rails_50.gemfile
|
24
|
-
# - gemfiles/rails_edge.gemfile
|
25
25
|
exclude:
|
26
|
+
- ruby_version: '3.2'
|
27
|
+
gemfile: gemfiles/rails_61.gemfile
|
28
|
+
- ruby_version: '3.2'
|
29
|
+
gemfile: gemfiles/rails_60.gemfile
|
30
|
+
- ruby_version: '3.2'
|
31
|
+
gemfile: gemfiles/rails_52.gemfile
|
32
|
+
- ruby_version: '3.2'
|
33
|
+
gemfile: gemfiles/rails_51.gemfile
|
34
|
+
- ruby_version: '3.2'
|
35
|
+
gemfile: gemfiles/rails_50.gemfile
|
26
36
|
- ruby_version: '3.1'
|
27
37
|
gemfile: gemfiles/rails_61.gemfile
|
28
38
|
- ruby_version: '3.1'
|
@@ -39,21 +49,23 @@ jobs:
|
|
39
49
|
gemfile: gemfiles/rails_51.gemfile
|
40
50
|
- ruby_version: '3.0'
|
41
51
|
gemfile: gemfiles/rails_50.gemfile
|
52
|
+
- ruby_version: '2.7'
|
53
|
+
gemfile: gemfiles/rails_71.gemfile
|
42
54
|
- ruby_version: '2.7'
|
43
55
|
gemfile: gemfiles/rails_52.gemfile
|
44
56
|
- ruby_version: '2.7'
|
45
57
|
gemfile: gemfiles/rails_51.gemfile
|
46
58
|
- ruby_version: '2.7'
|
47
59
|
gemfile: gemfiles/rails_50.gemfile
|
60
|
+
- ruby_version: '2.6'
|
61
|
+
gemfile: gemfiles/rails_71.gemfile
|
48
62
|
- ruby_version: '2.6'
|
49
63
|
gemfile: gemfiles/rails_70.gemfile
|
50
|
-
|
51
|
-
# gemfile: gemfiles/rails_edge.gemfile
|
52
|
-
runs-on: ubuntu-18.04
|
64
|
+
runs-on: ubuntu-22.04
|
53
65
|
env:
|
54
66
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
55
67
|
steps:
|
56
|
-
- uses: actions/checkout@
|
68
|
+
- uses: actions/checkout@v3
|
57
69
|
- name: Install curl
|
58
70
|
run: sudo apt-get install curl libcurl4-openssl-dev
|
59
71
|
- name: Set up Ruby
|
@@ -62,3 +74,67 @@ jobs:
|
|
62
74
|
ruby-version: ${{ matrix.ruby_version }}
|
63
75
|
bundler-cache: true
|
64
76
|
- run: bundle exec rake
|
77
|
+
|
78
|
+
rails_edge:
|
79
|
+
needs:
|
80
|
+
- mri
|
81
|
+
runs-on: ubuntu-22.04
|
82
|
+
env:
|
83
|
+
BUNDLE_GEMFILE: gemfiles/rails_edge.gemfile
|
84
|
+
steps:
|
85
|
+
- uses: actions/checkout@v3
|
86
|
+
- name: Install curl
|
87
|
+
run: sudo apt-get install curl libcurl4-openssl-dev
|
88
|
+
- name: Set up Ruby
|
89
|
+
uses: ruby/setup-ruby@v1
|
90
|
+
with:
|
91
|
+
ruby-version: 3.2
|
92
|
+
bundler-cache: true
|
93
|
+
- run: bundle exec rake || echo "Rails edge test is done."
|
94
|
+
|
95
|
+
ruby_edge:
|
96
|
+
needs:
|
97
|
+
- mri
|
98
|
+
strategy:
|
99
|
+
matrix:
|
100
|
+
ruby_version:
|
101
|
+
- 'ruby-head'
|
102
|
+
gemfile:
|
103
|
+
- gemfiles/rails_edge.gemfile
|
104
|
+
- gemfiles/rails_71.gemfile
|
105
|
+
runs-on: ubuntu-22.04
|
106
|
+
env:
|
107
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
108
|
+
steps:
|
109
|
+
- uses: actions/checkout@v3
|
110
|
+
- name: Install curl
|
111
|
+
run: sudo apt-get install curl libcurl4-openssl-dev
|
112
|
+
- name: Set up Ruby
|
113
|
+
uses: ruby/setup-ruby@v1
|
114
|
+
with:
|
115
|
+
ruby-version: ${{ matrix.ruby_version }}
|
116
|
+
bundler-cache: true
|
117
|
+
- run: bundle exec rake || echo "Ruby edge test is done."
|
118
|
+
|
119
|
+
# The curb gem does not work well with JRuby, so skipping for now...
|
120
|
+
# jruby:
|
121
|
+
# needs:
|
122
|
+
# - mri
|
123
|
+
# strategy:
|
124
|
+
# matrix:
|
125
|
+
# ruby_version:
|
126
|
+
# - 'jruby-9.4'
|
127
|
+
# - 'jruby-head'
|
128
|
+
# gemfile:
|
129
|
+
# - gemfiles/rails_70.gemfile
|
130
|
+
# runs-on: ubuntu-22.04
|
131
|
+
# env:
|
132
|
+
# BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
133
|
+
# steps:
|
134
|
+
# - uses: actions/checkout@v3
|
135
|
+
# - name: Set up Ruby
|
136
|
+
# uses: ruby/setup-ruby@v1
|
137
|
+
# with:
|
138
|
+
# ruby-version: ${{ matrix.ruby_version }}
|
139
|
+
# bundler-cache: true
|
140
|
+
# - run: bundle exec rake || echo "JRuby test is done."
|
data/Appraisals
CHANGED
@@ -4,6 +4,15 @@ appraise "rails_edge" do
|
|
4
4
|
gem "railties"
|
5
5
|
gem "activesupport"
|
6
6
|
end
|
7
|
+
|
8
|
+
gem "rackup"
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise "rails_71" do
|
12
|
+
gem "rails", '~> 7.1.0.beta1'
|
13
|
+
gem "railties", '~> 7.1.0.beta1'
|
14
|
+
gem "activesupport", '~> 7.1.0.beta1'
|
15
|
+
gem "rackup"
|
7
16
|
end
|
8
17
|
|
9
18
|
appraise "rails_70" do
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,24 @@
|
|
1
|
+
## v0.9.0
|
1
2
|
|
2
|
-
|
3
|
+
#### New Features
|
3
4
|
|
4
|
-
|
5
|
+
- Rails 7.1.0.beta1 is now officially supported
|
6
|
+
|
7
|
+
#### Fixes
|
8
|
+
|
9
|
+
- Fixes an issue where `graphql` gem `2.1.0` may not work with `graphql-client` (`b144ee2f`)
|
10
|
+
|
11
|
+
## [v0.8.0](https://github.com/yuki24/artemis/tree/v0.8.0)
|
12
|
+
|
13
|
+
_<sup>released at 2023-01-05 05:29:37 UTC</sup>_
|
14
|
+
|
15
|
+
#### New Features
|
16
|
+
|
17
|
+
- Ruby 3.2 is now officially supported
|
18
|
+
|
19
|
+
## [v0.7.0](https://github.com/yuki24/artemis/tree/v0.7.0)
|
20
|
+
|
21
|
+
_<sup>released at 2022-03-05 08:24:45 UTC</sup>_
|
5
22
|
|
6
23
|
#### Features
|
7
24
|
|
data/artemis.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
|
18
18
|
spec.add_dependency "activesupport", ">= 4.0.0"
|
19
19
|
spec.add_dependency "railties", ">= 4.0.0"
|
20
|
-
spec.add_dependency "graphql", "
|
20
|
+
spec.add_dependency "graphql", "< 2.1"
|
21
21
|
spec.add_dependency "graphql-client", ">= 0.13.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "appraisal", ">= 2.2"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "pry"
|
6
|
+
gem "pry-byebug", platforms: :mri
|
7
|
+
gem "curb", ">= 0.9.6"
|
8
|
+
gem "webrick"
|
9
|
+
gem "rails", "~> 7.1.0.beta1"
|
10
|
+
gem "railties", "~> 7.1.0.beta1"
|
11
|
+
gem "activesupport", "~> 7.1.0.beta1"
|
12
|
+
gem "rackup"
|
13
|
+
|
14
|
+
gemspec path: "../"
|
data/gemfiles/rails_edge.gemfile
CHANGED
@@ -8,6 +8,12 @@ rescue LoadError
|
|
8
8
|
# no-op... Rails 7.0 requires this.
|
9
9
|
end
|
10
10
|
|
11
|
+
begin
|
12
|
+
require 'active_support/deprecation'
|
13
|
+
require 'active_support/deprecator'
|
14
|
+
rescue LoadError
|
15
|
+
end
|
16
|
+
|
11
17
|
require 'active_support/core_ext/numeric/time'
|
12
18
|
require 'net/http/persistent'
|
13
19
|
|
data/lib/artemis/railtie.rb
CHANGED
@@ -61,7 +61,7 @@ module Artemis
|
|
61
61
|
if app.config.eager_load && app.config.cache_classes
|
62
62
|
Artemis::GraphQLEndpoint.registered_services.each do |endpoint_name|
|
63
63
|
begin
|
64
|
-
|
64
|
+
require_dependency endpoint_name # Rails 7.0+ requires this.
|
65
65
|
rescue LoadError
|
66
66
|
# no-op...
|
67
67
|
end
|
data/lib/artemis/version.rb
CHANGED
data/spec/adapters_spec.rb
CHANGED
@@ -2,6 +2,13 @@ require 'json'
|
|
2
2
|
require 'rack'
|
3
3
|
require 'webrick'
|
4
4
|
|
5
|
+
RACK_SERVER = begin
|
6
|
+
require 'rackup/handler/webrick'
|
7
|
+
Rackup::Handler::WEBrick
|
8
|
+
rescue LoadError
|
9
|
+
Rack::Handler::WEBrick
|
10
|
+
end
|
11
|
+
|
5
12
|
describe 'Adapters' do
|
6
13
|
FakeServer = ->(env) {
|
7
14
|
case env['PATH_INFO']
|
@@ -61,7 +68,7 @@ describe 'Adapters' do
|
|
61
68
|
Artemis::Adapters::AbstractAdapter.send(:attr_writer, :uri, :timeout)
|
62
69
|
|
63
70
|
@server_thread = Thread.new do
|
64
|
-
|
71
|
+
RACK_SERVER.run(FakeServer, Port: 8000, Logger: WEBrick::Log.new('/dev/null'), AccessLog: [])
|
65
72
|
end
|
66
73
|
|
67
74
|
loop do
|
@@ -75,7 +82,7 @@ describe 'Adapters' do
|
|
75
82
|
end
|
76
83
|
|
77
84
|
after :all do
|
78
|
-
|
85
|
+
RACK_SERVER.shutdown
|
79
86
|
@server_thread.terminate
|
80
87
|
end
|
81
88
|
|
data/spec/autoloading_spec.rb
CHANGED
@@ -1,56 +1,63 @@
|
|
1
1
|
describe "#{GraphQL::Client} Autoloading" do
|
2
2
|
describe ".load_constant" do
|
3
3
|
it "loads the specified constant if there is a matching graphql file" do
|
4
|
-
|
4
|
+
Github.send(:remove_const, :User) if Github.constants.include?(:User)
|
5
5
|
|
6
|
-
|
6
|
+
Github.load_constant(:User)
|
7
7
|
|
8
|
-
expect(defined?(
|
8
|
+
expect(defined?(Github::User)).to eq('constant')
|
9
9
|
end
|
10
10
|
|
11
11
|
it "does nothing and returns nil if there is no matching file" do
|
12
|
-
expect(
|
12
|
+
expect(Github.load_constant(:DoesNotExist)).to be_nil
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
describe ".preload!" do
|
17
17
|
it "preloads all the graphQL files in the query paths" do
|
18
|
-
%i(
|
19
|
-
.select {|const_name|
|
20
|
-
.each {|const_name|
|
18
|
+
%i(User UserRepositories Repository RepositoryFields)
|
19
|
+
.select {|const_name| Github.constants.include?(const_name) }
|
20
|
+
.each {|const_name| Github.send(:remove_const, const_name) }
|
21
21
|
|
22
|
-
|
22
|
+
Github.preload!
|
23
23
|
|
24
|
-
expect(defined?(
|
25
|
-
expect(defined?(
|
24
|
+
expect(defined?(Github::User)).to eq('constant')
|
25
|
+
expect(defined?(Github::Repository)).to eq('constant')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it "dynamically loads the matching GraphQL query and sets it to a constant" do
|
30
|
-
|
30
|
+
Github.send(:remove_const, :User) if Github.constants.include?(:User)
|
31
31
|
|
32
|
-
query =
|
32
|
+
query = Github::User
|
33
33
|
|
34
34
|
expect(query.document.to_query_string).to eq(<<~GRAPHQL.strip)
|
35
|
-
query
|
36
|
-
|
35
|
+
query Github__User {
|
36
|
+
user(login: "yuki24") {
|
37
|
+
id
|
37
38
|
name
|
38
|
-
bio
|
39
|
-
birthday
|
40
39
|
}
|
41
40
|
}
|
42
41
|
GRAPHQL
|
43
42
|
end
|
44
43
|
|
45
44
|
it "dynamically loads the matching GraphQL fragment and sets it to a constant" do
|
46
|
-
|
45
|
+
Github.send(:remove_const, :RepositoryFields) if Github.constants.include?(:RepositoryFields)
|
47
46
|
|
48
|
-
query =
|
47
|
+
query = Github::RepositoryFields
|
49
48
|
|
50
49
|
expect(query.document.to_query_string).to eq(<<~GRAPHQL.strip)
|
51
|
-
fragment
|
52
|
-
|
53
|
-
|
50
|
+
fragment Github__RepositoryFields on Repository {
|
51
|
+
name
|
52
|
+
nameWithOwner
|
53
|
+
url
|
54
|
+
updatedAt
|
55
|
+
languages(first: 1) {
|
56
|
+
nodes {
|
57
|
+
name
|
58
|
+
color
|
59
|
+
}
|
60
|
+
}
|
54
61
|
}
|
55
62
|
GRAPHQL
|
56
63
|
end
|
@@ -58,25 +65,24 @@ describe "#{GraphQL::Client} Autoloading" do
|
|
58
65
|
it "correctly loads the matching GraphQL query even when the top-level constant with the same name exists" do
|
59
66
|
# In Ruby <= 2.4 top-level constants can be looked up through a namespace, which turned out to be a bad practice.
|
60
67
|
# This has been removed in 2.5, but in earlier versions still suffer from this behaviour.
|
61
|
-
|
62
|
-
Object.send(:remove_const, :
|
68
|
+
Github.send(:remove_const, :User) if Github.constants.include?(:User)
|
69
|
+
Object.send(:remove_const, :User) if Object.constants.include?(:User)
|
63
70
|
|
64
71
|
begin
|
65
|
-
Object.send(:const_set, :
|
72
|
+
Object.send(:const_set, :User, 1)
|
66
73
|
|
67
|
-
|
74
|
+
Github.user
|
68
75
|
ensure
|
69
|
-
Object.send(:remove_const, :
|
76
|
+
Object.send(:remove_const, :User)
|
70
77
|
end
|
71
78
|
|
72
|
-
query =
|
79
|
+
query = Github::User
|
73
80
|
|
74
81
|
expect(query.document.to_query_string).to eq(<<~GRAPHQL.strip)
|
75
|
-
query
|
76
|
-
|
82
|
+
query Github__User {
|
83
|
+
user(login: "yuki24") {
|
84
|
+
id
|
77
85
|
name
|
78
|
-
bio
|
79
|
-
birthday
|
80
86
|
}
|
81
87
|
}
|
82
88
|
GRAPHQL
|
@@ -84,63 +90,63 @@ describe "#{GraphQL::Client} Autoloading" do
|
|
84
90
|
|
85
91
|
it "raises an exception when the path was resolved but the file does not exist" do
|
86
92
|
begin
|
87
|
-
|
93
|
+
Github.graphql_file_paths << "github/removed.graphql"
|
88
94
|
|
89
|
-
expect {
|
95
|
+
expect { Github::Removed }.to raise_error(Errno::ENOENT)
|
90
96
|
ensure
|
91
|
-
|
97
|
+
Github.graphql_file_paths.delete("github/removed.graphql")
|
92
98
|
end
|
93
99
|
end
|
94
100
|
|
95
101
|
it "raises an NameError when there is no graphql file that matches the const name" do
|
96
|
-
expect {
|
102
|
+
expect { Github::DoesNotExist }.to raise_error(NameError)
|
97
103
|
end
|
98
104
|
|
99
105
|
xit "defines the query method when the matching class method gets called for the first time" do
|
100
|
-
|
106
|
+
Github.undef_method(:user) if Github.public_instance_methods.include?(:user)
|
101
107
|
|
102
|
-
|
108
|
+
Github.user
|
103
109
|
|
104
|
-
expect(
|
110
|
+
expect(Github.public_instance_methods).to include(:user)
|
105
111
|
end
|
106
112
|
|
107
113
|
it "raises an NameError when there is no graphql file that matches the class method name" do
|
108
|
-
expect {
|
114
|
+
expect { Github.does_not_exist }.to raise_error(NameError)
|
109
115
|
end
|
110
116
|
|
111
117
|
it "raises an NameError when the class method name matches a fragment name" do
|
112
|
-
expect {
|
118
|
+
expect { Github.repository_fields_fragment }.to raise_error(NameError)
|
113
119
|
end
|
114
120
|
|
115
121
|
it "responds to a class method that has a matching graphQL file" do
|
116
|
-
expect(
|
122
|
+
expect(Github).to respond_to(:user)
|
117
123
|
end
|
118
124
|
|
119
125
|
it "does not respond to class methods that do not have a matching graphQL file" do
|
120
|
-
expect(
|
126
|
+
expect(Github).not_to respond_to(:does_not_exist)
|
121
127
|
end
|
122
128
|
|
123
129
|
xit "defines the query method when the matching instance method gets called for the first time" do
|
124
|
-
|
130
|
+
Github.undef_method(:user) if Github.public_instance_methods.include?(:user)
|
125
131
|
|
126
|
-
|
132
|
+
Github.new.user
|
127
133
|
|
128
|
-
expect(
|
134
|
+
expect(Github.public_instance_methods).to include(:user)
|
129
135
|
end
|
130
136
|
|
131
137
|
it "raises an NameError when there is no graphql file that matches the instance method name" do
|
132
|
-
expect {
|
138
|
+
expect { Github.new.does_not_exist }.to raise_error(NameError)
|
133
139
|
end
|
134
140
|
|
135
141
|
it "raises an NameError when the instance method name matches a fragment name" do
|
136
|
-
expect {
|
142
|
+
expect { Github.new.repository_fields_fragment }.to raise_error(NameError)
|
137
143
|
end
|
138
144
|
|
139
145
|
it "responds to the method that has a matching graphQL file" do
|
140
|
-
expect(
|
146
|
+
expect(Github.new).to respond_to(:user)
|
141
147
|
end
|
142
148
|
|
143
149
|
it "does not respond to methods that do not have a matching graphQL file" do
|
144
|
-
expect(
|
150
|
+
expect(Github.new).not_to respond_to(:does_not_exist)
|
145
151
|
end
|
146
152
|
end
|
data/spec/callbacks_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'active_support/core_ext/module/attribute_accessors'
|
|
3
3
|
describe "#{GraphQL::Client} Callbacks" do
|
4
4
|
Client = Class.new(Artemis::Client) do
|
5
5
|
def self.name
|
6
|
-
'
|
6
|
+
'Github'
|
7
7
|
end
|
8
8
|
|
9
9
|
mattr_accessor :before_callback, :after_callback
|
@@ -35,20 +35,20 @@ describe "#{GraphQL::Client} Callbacks" do
|
|
35
35
|
|
36
36
|
describe ".before_execute" do
|
37
37
|
it "gets invoked before executing" do
|
38
|
-
Client.
|
38
|
+
Client.repository(owner: "yuki24", name: "artemis", context: { user_id: 'yuki24' })
|
39
39
|
|
40
40
|
document, operation_name, variables, context = Client.before_callback
|
41
41
|
|
42
|
-
expect(document).to eq(Client::
|
43
|
-
expect(operation_name).to eq('
|
44
|
-
expect(variables).to eq(
|
42
|
+
expect(document).to eq(Client::Repository.document)
|
43
|
+
expect(operation_name).to eq('Client__Repository')
|
44
|
+
expect(variables).to eq("name" => "artemis", "owner" => "yuki24")
|
45
45
|
expect(context).to eq(user_id: 'yuki24')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe ".after_execute" do
|
50
50
|
it "gets invoked after executing" do
|
51
|
-
Client.
|
51
|
+
Client.user
|
52
52
|
|
53
53
|
data, errors, extensions = Client.after_callback
|
54
54
|
|