artemis 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -0,0 +1,17 @@
|
|
1
|
+
yuki24_artemis:
|
2
|
+
data:
|
3
|
+
repository:
|
4
|
+
name: artemis
|
5
|
+
nameWithOwner: yuki24/artemis
|
6
|
+
|
7
|
+
yuki24_rambulance:
|
8
|
+
data:
|
9
|
+
repository:
|
10
|
+
name: rambulance
|
11
|
+
nameWithOwner: <%= "yuki24" %>/rambulance
|
12
|
+
|
13
|
+
yoshiki:
|
14
|
+
data:
|
15
|
+
repository:
|
16
|
+
name: did_you_mean
|
17
|
+
nameWithOwner: ruby/did_you_mean
|
data/spec/spec_helper.rb
CHANGED
@@ -13,10 +13,10 @@ require 'pry-byebug' if RUBY_ENGINE == 'ruby'
|
|
13
13
|
# tested, but we don't have any test setup for that yet.
|
14
14
|
Artemis::Client.query_paths = [File.join(__dir__, 'fixtures')]
|
15
15
|
Artemis::GraphQLEndpoint.suppress_warnings_on_schema_load = true
|
16
|
-
Artemis::GraphQLEndpoint.register!(:
|
17
|
-
Artemis::GraphQLEndpoint.lookup(:
|
16
|
+
Artemis::GraphQLEndpoint.register!(:github, adapter: :test, url: '', schema_path: 'spec/fixtures/github/schema.json')
|
17
|
+
Artemis::GraphQLEndpoint.lookup(:github).load_schema!
|
18
18
|
|
19
|
-
require 'fixtures/
|
19
|
+
require 'fixtures/github'
|
20
20
|
|
21
21
|
PROJECT_DIR = FileUtils.pwd
|
22
22
|
|
data/spec/test_helper_spec.rb
CHANGED
@@ -14,79 +14,79 @@ describe Artemis::TestHelper do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "can mock a GraphQL request" do
|
17
|
-
stub_graphql(
|
17
|
+
stub_graphql(Github, :repository).to_return(:yuki24_artemis)
|
18
18
|
|
19
|
-
response =
|
19
|
+
response = Github.repository(owner: "yuki24", name: "artemis")
|
20
20
|
|
21
|
-
expect(response.data.
|
22
|
-
expect(response.data.
|
21
|
+
expect(response.data.repository.name).to eq("artemis")
|
22
|
+
expect(response.data.repository.name_with_owner).to eq("yuki24/artemis")
|
23
23
|
end
|
24
24
|
|
25
25
|
it "can mock a GraphQL request with an ERB-enabled fixture" do
|
26
|
-
stub_graphql(
|
26
|
+
stub_graphql(Github, :repository).to_return(:yuki24_rambulance)
|
27
27
|
|
28
|
-
response =
|
28
|
+
response = Github.repository(owner: "yuki24", name: "rambulance")
|
29
29
|
|
30
|
-
expect(response.data.
|
30
|
+
expect(response.data.repository.name_with_owner).to eq("yuki24/rambulance")
|
31
31
|
end
|
32
32
|
|
33
33
|
it "can mock a GraphQL request with variables using exact match" do
|
34
|
-
stub_graphql(
|
35
|
-
stub_graphql(
|
34
|
+
stub_graphql(Github, :repository, owner: "yuki24", name: "artemis").to_return(:yuki24_artemis)
|
35
|
+
stub_graphql(Github, :repository, owner: "yuki24", name: "rambulance").to_return(:yuki24_rambulance)
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
yuki24_artemis = Github.repository(owner: "yuki24", name: "artemis")
|
38
|
+
yuki24_rambulance = Github.repository(owner: "yuki24", name: "rambulance")
|
39
39
|
|
40
|
-
expect(
|
41
|
-
expect(
|
40
|
+
expect(yuki24_artemis.data.repository.name).to eq("artemis")
|
41
|
+
expect(yuki24_rambulance.data.repository.name).to eq("rambulance")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "can mock a GraphQL request with a JSON file" do
|
45
|
-
stub_graphql(
|
45
|
+
stub_graphql(Github, :user).to_return(:yuki24)
|
46
46
|
|
47
|
-
response =
|
47
|
+
response = Github.user
|
48
48
|
|
49
|
-
expect(response.data.
|
50
|
-
expect(response.data.
|
49
|
+
expect(response.data.user.id).to eq("foobar")
|
50
|
+
expect(response.data.user.name).to eq("Yuki Nishijima")
|
51
51
|
end
|
52
52
|
|
53
53
|
it "can mock a GraphQL request for a query that has a query name"
|
54
54
|
|
55
55
|
it "raises an exception if the specified fixture file does not exist" do
|
56
|
-
expect { stub_graphql(
|
56
|
+
expect { stub_graphql(Github, :does_not_exist).to_return(:data) }
|
57
57
|
.to raise_error(Artemis::FixtureNotFound, %r|does_not_exist.{yml,json}|)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "raises an exception if the specified fixture file exists but fixture key does not exist" do
|
61
|
-
expect { stub_graphql(
|
62
|
-
.to raise_error(Artemis::FixtureNotFound, %r|spec/fixtures/responses/
|
61
|
+
expect { stub_graphql(Github, :repository).to_return(:does_not_exist) }
|
62
|
+
.to raise_error(Artemis::FixtureNotFound, %r|spec/fixtures/responses/github/repository.yml|)
|
63
63
|
end
|
64
64
|
|
65
|
-
it "picks up the fixture for the given
|
66
|
-
stub_graphql(
|
65
|
+
it "picks up the fixture for the given service if multiple services have the exact same fixture" do
|
66
|
+
stub_graphql(Github, :repository).to_return(:yoshiki)
|
67
67
|
|
68
|
-
yoshiki =
|
68
|
+
yoshiki = Github.repository(owner: "ruby", name: "did_you_mean")
|
69
69
|
|
70
|
-
expect(yoshiki.data.
|
70
|
+
expect(yoshiki.data.repository.name).to eq("did_you_mean")
|
71
71
|
end
|
72
72
|
|
73
73
|
it "can mock separate GraphQL queries with the same arguments" do
|
74
|
-
stub_graphql("SpotifyClient", :
|
75
|
-
stub_graphql(
|
74
|
+
stub_graphql("SpotifyClient", :repository, id: "yoshiki").to_return(:yoshiki)
|
75
|
+
stub_graphql(Github, :repository, id: "yoshiki").to_return(:yoshiki)
|
76
76
|
|
77
|
-
yoshiki =
|
77
|
+
yoshiki = Github.repository(id: "yoshiki")
|
78
78
|
|
79
|
-
expect(yoshiki.data.
|
79
|
+
expect(yoshiki.data.repository.name).to eq("did_you_mean")
|
80
80
|
end
|
81
81
|
|
82
82
|
it "allows to get raw fixture data as a Hash" do
|
83
|
-
data = stub_graphql("SpotifyClient", :
|
83
|
+
data = stub_graphql("SpotifyClient", :repository).get(:yoshiki)
|
84
84
|
|
85
85
|
expect(data).to eq({
|
86
86
|
"data" => {
|
87
|
-
"
|
88
|
-
"
|
89
|
-
"
|
87
|
+
"repository" => {
|
88
|
+
"name" => "did_you_mean",
|
89
|
+
"nameWithOwner" => "ruby/did_you_mean",
|
90
90
|
}
|
91
91
|
}
|
92
92
|
})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artemis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Allured
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-09-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,16 +43,16 @@ dependencies:
|
|
43
43
|
name: graphql
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - "<"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '1
|
48
|
+
version: '2.1'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - "<"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '1
|
55
|
+
version: '2.1'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: graphql-client
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- gemfiles/rails_60.gemfile
|
169
169
|
- gemfiles/rails_61.gemfile
|
170
170
|
- gemfiles/rails_70.gemfile
|
171
|
+
- gemfiles/rails_71.gemfile
|
171
172
|
- gemfiles/rails_edge.gemfile
|
172
173
|
- lib/artemis.rb
|
173
174
|
- lib/artemis/adapters.rb
|
@@ -201,14 +202,14 @@ files:
|
|
201
202
|
- spec/callbacks_spec.rb
|
202
203
|
- spec/client_spec.rb
|
203
204
|
- spec/endpoint_spec.rb
|
204
|
-
- spec/fixtures/
|
205
|
-
- spec/fixtures/
|
206
|
-
- spec/fixtures/
|
207
|
-
- spec/fixtures/
|
208
|
-
- spec/fixtures/
|
209
|
-
- spec/fixtures/
|
210
|
-
- spec/fixtures/responses/
|
211
|
-
- spec/fixtures/responses/
|
205
|
+
- spec/fixtures/github.rb
|
206
|
+
- spec/fixtures/github/_repository_fields.graphql
|
207
|
+
- spec/fixtures/github/repository.graphql
|
208
|
+
- spec/fixtures/github/schema.json
|
209
|
+
- spec/fixtures/github/user.graphql
|
210
|
+
- spec/fixtures/github/user_repositories.graphql
|
211
|
+
- spec/fixtures/responses/github/repository.yml
|
212
|
+
- spec/fixtures/responses/github/user.json
|
212
213
|
- spec/fixtures/responses/spotify_client/artist.yml
|
213
214
|
- spec/spec_helper.rb
|
214
215
|
- spec/test_helper_spec.rb
|
@@ -232,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
233
|
- !ruby/object:Gem::Version
|
233
234
|
version: '0'
|
234
235
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
236
|
+
rubygems_version: 3.4.19
|
236
237
|
signing_key:
|
237
238
|
specification_version: 4
|
238
239
|
summary: GraphQL on Rails
|