evil-client 3.1.0 → 3.3.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/ci.yml +19 -1
- data/CHANGELOG.md +16 -3
- data/Gemfile +1 -0
- data/README.md +4 -1
- data/docs/helpers/headers.md +1 -1
- data/docs/helpers/operation.md +1 -1
- data/docs/index.md +1 -1
- data/docs/rspec.md +1 -1
- data/evil-client.gemspec +2 -1
- data/lefthook.yml +8 -0
- data/lib/evil/client/builder.rb +1 -1
- data/lib/evil/client/model.rb +4 -4
- data/lib/evil/client/resolver/request.rb +1 -1
- data/lib/evil/client/rspec.rb +21 -19
- data/lib/evil/client/schema/operation.rb +2 -2
- data/spec/features/scope/options_spec.rb +0 -9
- data/spec/fixtures/test_client.rb +1 -1
- data/spec/spec_helper.rb +8 -0
- data/spec/unit/connection_spec.rb +31 -13
- data/spec/unit/container/operation_spec.rb +1 -1
- data/spec/unit/formatter_spec.rb +5 -1
- data/spec/unit/model_spec.rb +31 -9
- data/spec/unit/resolver/middleware_spec.rb +1 -1
- data/spec/unit/resolver/query_spec.rb +1 -1
- data/spec/unit/resolver/request_spec.rb +7 -2
- data/spec/unit/settings_spec.rb +5 -5
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28ec48c1990e681109444ef9e1719b281f01987cb8d69b6cf811269d64b25cc7
|
4
|
+
data.tar.gz: f7bcea09f27029c17bccde9e59e840d012778a70c6e94b3f99e39b315aff7ba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2379b7d719a25c2d8c4a5cceb549f48576e812895f05e7688ae9713dcbf3d669aa0fac2427bb46918c6124d11089a8d9c21f9113fe8d92c9a625f4aeadb81025
|
7
|
+
data.tar.gz: b505024fdd4df36dddc7cc2c8503219319058e0e68e2e3dc16ef6b0aa26883ee87aec145017a9e7188296687f3380aa352d377b24aeb1f2010ad77f237241f73
|
data/.github/workflows/ci.yml
CHANGED
@@ -30,7 +30,7 @@ jobs:
|
|
30
30
|
run: sudo apt-get install libpq-dev
|
31
31
|
|
32
32
|
- name: Install Ruby ${{ matrix.ruby }}
|
33
|
-
uses: ruby/setup-ruby@v1
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
34
|
with:
|
35
35
|
ruby-version: ${{ matrix.ruby }}
|
36
36
|
bundler-cache: true # 'bundle install' and cache
|
@@ -42,3 +42,21 @@ jobs:
|
|
42
42
|
- name: Run tests
|
43
43
|
run: bundle exec rake --trace
|
44
44
|
continue-on-error: false
|
45
|
+
|
46
|
+
- name: Report coverage
|
47
|
+
uses: coverallsapp/github-action@v2
|
48
|
+
with:
|
49
|
+
flag-name: ruby-${{ matrix.ruby }}
|
50
|
+
parallel: true
|
51
|
+
|
52
|
+
coveralls-done:
|
53
|
+
if: always()
|
54
|
+
name: Finish coverage reporting
|
55
|
+
runs-on: ubuntu-latest
|
56
|
+
needs: build
|
57
|
+
steps:
|
58
|
+
- name: Coveralls done
|
59
|
+
uses: coverallsapp/github-action@v2
|
60
|
+
with:
|
61
|
+
parallel-finished: true
|
62
|
+
carryforward: "ruby-2.6.0,ruby-3.0.0,ruby-head"
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog], and this project adheres
|
5
5
|
to [Semantic Versioning].
|
6
6
|
|
7
|
+
## [3.3.0] [2025-01-09]
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- Rename `rack.version` to `rack.release` to follow deprecation of `Rack::VERSION` (@mrexox)
|
11
|
+
- Add dependency from `base64` which is absent in latest versions of ruby (@mrexox)
|
12
|
+
|
13
|
+
## [3.2.0] [2023-01-18]
|
14
|
+
|
15
|
+
### Added
|
16
|
+
- Support for plain hash argument in the model (@nepalez)
|
17
|
+
|
7
18
|
## [3.1.0] [2022-07-04]
|
8
19
|
|
9
20
|
### Added
|
@@ -173,7 +184,7 @@ drastically in many important details.
|
|
173
184
|
|
174
185
|
### [BREAKING] Changed
|
175
186
|
|
176
|
-
- There is no more
|
187
|
+
- There is no more differences between "root" DSL, DSL of scope and
|
177
188
|
operation. All scopes use exactly the same methods. All operations
|
178
189
|
uses just the same methods except for `#operation` and `#scope` that
|
179
190
|
provide further nesting.
|
@@ -458,7 +469,7 @@ formats will be added.
|
|
458
469
|
```
|
459
470
|
|
460
471
|
This time response handler will try processing a response using various
|
461
|
-
definitions (in order of their declaration) until some suits. The
|
472
|
+
definitions (in order of their declaration) until some suits. The handler
|
462
473
|
returns `ResponseError` in case no definition proves suitable.
|
463
474
|
|
464
475
|
Names (the first param) are unique. When several definitions use the same name,
|
@@ -501,4 +512,6 @@ formats will be added.
|
|
501
512
|
[3.0.3]: https://github.com/evilmartians/evil-client/compare/v3.0.2...v3.0.3
|
502
513
|
[3.0.4]: https://github.com/evilmartians/evil-client/compare/v3.0.3...v3.0.4
|
503
514
|
[3.0.5]: https://github.com/evilmartians/evil-client/compare/v3.0.4...v3.0.5
|
504
|
-
[3.1.0]: https://github.com/evilmartians/evil-client/compare/v3.0.5...v3.1.0
|
515
|
+
[3.1.0]: https://github.com/evilmartians/evil-client/compare/v3.0.5...v3.1.0
|
516
|
+
[3.2.0]: https://github.com/evilmartians/evil-client/compare/v3.1.0...v3.2.0
|
517
|
+
[3.3.0]: https://github.com/evilmartians/evil-client/compare/v3.2.0...v3.3.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Human-friendly DSL for writing HTTP(s) clients in Ruby
|
|
8
8
|
[![Gem Version][gem-badger]][gem]
|
9
9
|
[![Inline docs][inch-badger]][inch]
|
10
10
|
[![Documentation Status][readthedocs-badger]][readthedocs]
|
11
|
+
[![Coverage Status][coveralls-badger]][coveralls]
|
11
12
|
|
12
13
|
## Intro
|
13
14
|
|
@@ -78,7 +79,7 @@ class CatsClient < Evil::Client
|
|
78
79
|
end
|
79
80
|
|
80
81
|
# Parses json response, wraps it into model with [#error] and raises
|
81
|
-
# an exception where [ResponseError#response] contains the model
|
82
|
+
# an exception where [ResponseError#response] contains the model instance
|
82
83
|
response(400, 422) { |(status, *)| raise "#{status}: Record invalid" }
|
83
84
|
end
|
84
85
|
end
|
@@ -115,3 +116,5 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
115
116
|
[swagger]: http://swagger.io
|
116
117
|
[readthedocs-badger]: https://readthedocs.org/projects/evilclient/badge/?version=latest
|
117
118
|
[readthedocs]: http://evilclient.readthedocs.io/en/latest
|
119
|
+
[coveralls-badger]: https://coveralls.io/repos/github/evilmartians/evil-client/badge.svg?branch=master
|
120
|
+
[coveralls]: https://coveralls.io/github/evilmartians/evil-client?branch=master
|
data/docs/helpers/headers.md
CHANGED
@@ -12,7 +12,7 @@ class CatsClient < Evil::Client
|
|
12
12
|
end
|
13
13
|
```
|
14
14
|
|
15
|
-
Remember that you can define header values as a flat array instead of the string. Inside an array all the values are counted as
|
15
|
+
Remember that you can define header values as a flat array instead of the string. Inside an array all the values are counted as strings.
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
headers { "Language" => ["ru_RU", "charset=utf-8"] }
|
data/docs/helpers/operation.md
CHANGED
@@ -78,7 +78,7 @@ The user of custom client sends a request by invoking some operation by name on
|
|
78
78
|
|
79
79
|
```ruby
|
80
80
|
client = CatsClient.new
|
81
|
-
cats = client.cats # scope for the `fetch`
|
81
|
+
cats = client.cats # scope for the `fetch` operation
|
82
82
|
|
83
83
|
cats.fetch id: 44 # sends request and returns a processed response
|
84
84
|
```
|
data/docs/index.md
CHANGED
@@ -78,7 +78,7 @@ class CatsClient < Evil::Client
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# Parses json response, wraps it into model with [#error] and raises
|
81
|
-
# an exception where [ResponseError#response] contains the model
|
81
|
+
# an exception where [ResponseError#response] contains the model instance
|
82
82
|
response(400, 422) { |(status, *)| raise "#{status}: Record invalid" }
|
83
83
|
end
|
84
84
|
end
|
data/docs/rspec.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
When you provide a client to remote API, you would provide some means for its users to test their operations.
|
2
2
|
|
3
|
-
Surely, they could use [webmock] to check the ultimate requests that are sent to the server. But doing this, they would
|
3
|
+
Surely, they could use [webmock] to check the ultimate requests that are sent to the server. But doing this, they would inadvertently specify not their own code, but your client's code too. What do they actually need is a means to stub and check invocations of your client's operations. This way they would back on correctness of your client, and take its interface as an endpoint.
|
4
4
|
|
5
5
|
For this reason, we support a special RSpec stubs and expectations. sThey are not loaded by default, so you must require it first, and then include the module:
|
6
6
|
|
data/evil-client.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "evil-client"
|
3
|
-
gem.version = "3.
|
3
|
+
gem.version = "3.3.0"
|
4
4
|
gem.author = ["Andrew Kozin (nepalez)", "Ravil Bairamgalin (brainopia)"]
|
5
5
|
gem.email = ["andrew.kozin@gmail.com", "nepalez@evilmartians.com"]
|
6
6
|
gem.homepage = "https://github.com/evilmartians/evil-client"
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
|
14
14
|
gem.required_ruby_version = ">= 2.6"
|
15
15
|
|
16
|
+
gem.add_runtime_dependency "base64", ">= 0.2.0", "< 0.3"
|
16
17
|
gem.add_runtime_dependency "dry-initializer", ">= 2.1"
|
17
18
|
gem.add_runtime_dependency "mime-types", ">= 3.1"
|
18
19
|
gem.add_runtime_dependency "rack", ">= 2"
|
data/lefthook.yml
ADDED
data/lib/evil/client/builder.rb
CHANGED
@@ -11,7 +11,7 @@ class Evil::Client
|
|
11
11
|
class Builder
|
12
12
|
Names.clean(self) # Remove unnecessary methods from the instance
|
13
13
|
|
14
|
-
# Load concrete implementations for the
|
14
|
+
# Load concrete implementations for the abstract builder
|
15
15
|
require_relative "builder/scope"
|
16
16
|
require_relative "builder/operation"
|
17
17
|
|
data/lib/evil/client/model.rb
CHANGED
@@ -88,12 +88,12 @@ class Evil::Client
|
|
88
88
|
|
89
89
|
# Model instance constructor
|
90
90
|
#
|
91
|
-
# @param
|
91
|
+
# @param [Hash] options The list of options as a plain hash
|
92
92
|
# @return [Evil::Client::Model]
|
93
93
|
#
|
94
|
-
def new(**
|
95
|
-
|
96
|
-
super(**
|
94
|
+
def new(options = {}, **kwargs)
|
95
|
+
kwargs = Hash(options).transform_keys(&:to_sym).merge(kwargs)
|
96
|
+
super(**kwargs).tap { |item| in_english { policy[item].validate! } }
|
97
97
|
end
|
98
98
|
alias call new
|
99
99
|
alias [] call
|
@@ -35,7 +35,7 @@ class Evil::Client
|
|
35
35
|
"SERVER_NAME" => uri.host,
|
36
36
|
"SERVER_PORT" => uri.port,
|
37
37
|
"HTTP_Variables" => headers,
|
38
|
-
"rack.
|
38
|
+
"rack.release" => Rack.release,
|
39
39
|
"rack.url_scheme" => uri.scheme,
|
40
40
|
"rack.input" => Formatter.call(body, format, boundary: boundary),
|
41
41
|
"rack.multithread" => false,
|
data/lib/evil/client/rspec.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Evil
|
2
|
+
class Client
|
3
|
+
#
|
4
|
+
# Collection of RSpec-related definitions
|
5
|
+
#
|
6
|
+
module RSpec
|
7
|
+
require_relative "rspec/evil_client_schema_matching"
|
8
|
+
require_relative "rspec/base_stub"
|
9
|
+
require_relative "rspec/allow_stub"
|
10
|
+
require_relative "rspec/expect_stub"
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
def stub_client_operation(klass = Evil::Client, name = nil)
|
13
|
+
AllowStub.new(klass, name)
|
14
|
+
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
def expect_client_operation(klass, name = nil)
|
17
|
+
ExpectStub.new(klass, name)
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def unstub_all
|
21
|
+
allow(Evil::Client::Container::Operation)
|
22
|
+
.to receive(:new)
|
23
|
+
.and_call_original
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -101,7 +101,7 @@ class Evil::Client
|
|
101
101
|
# Adds query definition to the schema
|
102
102
|
#
|
103
103
|
# Query should be a nested hash.
|
104
|
-
#
|
104
|
+
# When subscope or operation reloads previously defined query,
|
105
105
|
# new definition are merged deeply to older one. You can populate
|
106
106
|
# a query step-by-step from client root to an operation.
|
107
107
|
#
|
@@ -117,7 +117,7 @@ class Evil::Client
|
|
117
117
|
#
|
118
118
|
# It is expected the body to correspond to [#format].
|
119
119
|
#
|
120
|
-
# When a format is :json, the body should be
|
120
|
+
# When a format is :json, the body should be convertible to json
|
121
121
|
# When a format is :text, the body should be stringified
|
122
122
|
# When a format is :form, the body should be a hash
|
123
123
|
# When a format is :multipart, the body can be object or array of objects
|
@@ -32,15 +32,6 @@ RSpec.describe "scope options" do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
context "when required options missed" do
|
36
|
-
subject { client.crm }
|
37
|
-
|
38
|
-
it "raises StandardError" do
|
39
|
-
expect { subject }
|
40
|
-
.to raise_error StandardError, /version/
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
35
|
context "when some validation failed" do
|
45
36
|
subject { crm.users(token: nil) }
|
46
37
|
|
data/spec/spec_helper.rb
CHANGED
@@ -15,7 +15,7 @@ RSpec.describe Evil::Client::Connection, ".call" do
|
|
15
15
|
"Authorization" => "Bearer eoiqopr==",
|
16
16
|
"Content-Type" => "application/json"
|
17
17
|
},
|
18
|
-
"rack.
|
18
|
+
"rack.release" => Rack.release,
|
19
19
|
"rack.input" => "name=Andrew&age=46",
|
20
20
|
"rack.url_scheme" => "https",
|
21
21
|
"rack.multithread" => false,
|
@@ -57,22 +57,40 @@ RSpec.describe Evil::Client::Connection, ".call" do
|
|
57
57
|
it "logs the request" do
|
58
58
|
subject
|
59
59
|
|
60
|
-
|
61
|
-
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4.0")
|
61
|
+
<<-LOG.gsub(/^ +\|/, "").lines.each { |l| expect(log.string).to include l }
|
62
|
+
|INFO -- Evil::Client::Connection: sending request:
|
63
|
+
|INFO -- Evil::Client::Connection: Url | https://foo.com/api/v77/users/43?version=77&verbose=true
|
64
|
+
|INFO -- Evil::Client::Connection: Headers | {"Foo"=>"BAR", "Baz"=>"QUX", "Authorization"=>"Bearer eoiqopr==", "Content-Type"=>"application/json"}
|
65
|
+
|INFO -- Evil::Client::Connection: Body | name=Andrew&age=46
|
66
|
+
LOG
|
67
|
+
else
|
68
|
+
<<-LOG.gsub(/^ +\|/, "").lines.each { |l| expect(log.string).to include l }
|
69
|
+
|INFO -- Evil::Client::Connection: sending request:
|
70
|
+
|INFO -- Evil::Client::Connection: Url | https://foo.com/api/v77/users/43?version=77&verbose=true
|
71
|
+
|INFO -- Evil::Client::Connection: Headers | {"Foo" => "BAR", "Baz" => "QUX", "Authorization" => "Bearer eoiqopr==", "Content-Type" => "application/json"}
|
72
|
+
|INFO -- Evil::Client::Connection: Body | name=Andrew&age=46
|
73
|
+
LOG
|
74
|
+
end
|
66
75
|
end
|
67
76
|
|
68
77
|
it "logs the response" do
|
69
78
|
subject
|
70
79
|
|
71
|
-
|
72
|
-
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
80
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4.0")
|
81
|
+
<<-LOG.gsub(/^ +\|/, "").lines.each { |l| expect(log.string).to include l }
|
82
|
+
|INFO -- Evil::Client::Connection: receiving response:
|
83
|
+
|INFO -- Evil::Client::Connection: Status | 200
|
84
|
+
|INFO -- Evil::Client::Connection: Headers | {"content-language"=>["en_AU"]}
|
85
|
+
|INFO -- Evil::Client::Connection: Body | ["Done!"]
|
86
|
+
LOG
|
87
|
+
else
|
88
|
+
<<-LOG.gsub(/^ +\|/, "").lines.each { |l| expect(log.string).to include l }
|
89
|
+
|INFO -- Evil::Client::Connection: receiving response:
|
90
|
+
|INFO -- Evil::Client::Connection: Status | 200
|
91
|
+
|INFO -- Evil::Client::Connection: Headers | {"content-language" => ["en_AU"]}
|
92
|
+
|INFO -- Evil::Client::Connection: Body | ["Done!"]
|
93
|
+
LOG
|
94
|
+
end
|
77
95
|
end
|
78
96
|
end
|
@@ -69,7 +69,7 @@ RSpec.describe Evil::Client::Container::Operation do
|
|
69
69
|
expect(subject).to eq "result" => "success"
|
70
70
|
end
|
71
71
|
|
72
|
-
context "
|
72
|
+
context "when a client has custom connection" do
|
73
73
|
let(:connection) { double call: [200, {}, %w[{"result":"wow"}]] }
|
74
74
|
|
75
75
|
it "sends request to selected connection" do
|
data/spec/unit/formatter_spec.rb
CHANGED
@@ -23,7 +23,11 @@ RSpec.describe Evil::Client::Formatter do
|
|
23
23
|
let(:format) { :text }
|
24
24
|
|
25
25
|
it "returns formatted body as plain text" do
|
26
|
-
|
26
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4.0")
|
27
|
+
expect(subject).to eq "{:foo=>:bar}"
|
28
|
+
else
|
29
|
+
expect(subject).to eq "{foo: :bar}"
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
data/spec/unit/model_spec.rb
CHANGED
@@ -108,18 +108,40 @@ RSpec.describe Evil::Client::Model do
|
|
108
108
|
|
109
109
|
subject { model }
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
111
|
+
context "with kwargs" do
|
112
|
+
let(:model) { klass.new(**options) }
|
113
|
+
|
114
|
+
it "behaves like a model" do
|
115
|
+
expect(subject).to be_a klass
|
116
|
+
expect(subject.email).to eq "joe@example.com"
|
117
|
+
end
|
115
118
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
+
it "injects options from the other model" do
|
120
|
+
expect(subject.first_name).to eq "Joe"
|
121
|
+
expect(subject.last_name).to eq "Doe"
|
122
|
+
end
|
123
|
+
|
124
|
+
it "injects memoizers from the other model" do
|
125
|
+
expect(subject.name).to eq "Joe Doe"
|
126
|
+
end
|
119
127
|
end
|
120
128
|
|
121
|
-
|
122
|
-
|
129
|
+
context "with hash argument" do
|
130
|
+
let(:model) { klass.new(options) }
|
131
|
+
|
132
|
+
it "behaves like a model" do
|
133
|
+
expect(subject).to be_a klass
|
134
|
+
expect(subject.email).to eq "joe@example.com"
|
135
|
+
end
|
136
|
+
|
137
|
+
it "injects options from the other model" do
|
138
|
+
expect(subject.first_name).to eq "Joe"
|
139
|
+
expect(subject.last_name).to eq "Doe"
|
140
|
+
end
|
141
|
+
|
142
|
+
it "injects memoizers from the other model" do
|
143
|
+
expect(subject.name).to eq "Joe Doe"
|
144
|
+
end
|
123
145
|
end
|
124
146
|
|
125
147
|
context "with invalid options" do
|
@@ -72,7 +72,7 @@ RSpec.describe Evil::Client::Resolver::Middleware, ".call" do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
context "when middleware
|
75
|
+
context "when middleware definition has wrong format" do
|
76
76
|
before { schema.definitions[:middleware] = proc { 1323 } }
|
77
77
|
|
78
78
|
it "raises Evil::Client::DefinitionError" do
|
@@ -74,7 +74,7 @@ RSpec.describe Evil::Client::Resolver::Query, ".call" do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
context "when query
|
77
|
+
context "when query definition returns neither hash nor nil" do
|
78
78
|
before { schema.definitions[:query] = proc { 1323 } }
|
79
79
|
|
80
80
|
it "raises Evil::Client::DefinitionError" do
|
@@ -50,7 +50,7 @@ RSpec.describe Evil::Client::Resolver::Request, ".call" do
|
|
50
50
|
"Authorization" => "Bearer eoiqopr==",
|
51
51
|
"Content-Type" => "application/json"
|
52
52
|
},
|
53
|
-
"rack.
|
53
|
+
"rack.release" => Rack.release,
|
54
54
|
"rack.input" => '{"version":"v77"}',
|
55
55
|
"rack.url_scheme" => "https",
|
56
56
|
"rack.multithread" => false,
|
@@ -82,7 +82,12 @@ RSpec.describe Evil::Client::Resolver::Request, ".call" do
|
|
82
82
|
context "with :text format" do
|
83
83
|
before do
|
84
84
|
schema.definitions[:format] = -> { :text }
|
85
|
-
environment["rack.input"] =
|
85
|
+
environment["rack.input"] =
|
86
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4.0")
|
87
|
+
'{:version=>"v77"}'
|
88
|
+
else
|
89
|
+
'{version: "v77"}'
|
90
|
+
end
|
86
91
|
environment["HTTP_Variables"]["Content-Type"] = "text/plain"
|
87
92
|
end
|
88
93
|
|
data/spec/unit/settings_spec.rb
CHANGED
@@ -105,7 +105,7 @@ RSpec.describe Evil::Client::Settings do
|
|
105
105
|
describe ".name" do
|
106
106
|
subject { klass.name }
|
107
107
|
|
108
|
-
it "represents
|
108
|
+
it "represents settings class in a human-friendly manner" do
|
109
109
|
expect(subject).to eq "Test::Api.users.update"
|
110
110
|
end
|
111
111
|
end
|
@@ -113,7 +113,7 @@ RSpec.describe Evil::Client::Settings do
|
|
113
113
|
describe ".inspect" do
|
114
114
|
subject { klass.inspect }
|
115
115
|
|
116
|
-
it "represents
|
116
|
+
it "represents settings class in a human-friendly manner" do
|
117
117
|
expect(subject).to eq "Test::Api.users.update"
|
118
118
|
end
|
119
119
|
end
|
@@ -121,7 +121,7 @@ RSpec.describe Evil::Client::Settings do
|
|
121
121
|
describe ".to_s" do
|
122
122
|
subject { klass.to_s }
|
123
123
|
|
124
|
-
it "represents
|
124
|
+
it "represents settings class in a human-friendly manner" do
|
125
125
|
expect(subject).to eq "Test::Api.users.update"
|
126
126
|
end
|
127
127
|
end
|
@@ -129,7 +129,7 @@ RSpec.describe Evil::Client::Settings do
|
|
129
129
|
describe ".to_str" do
|
130
130
|
subject { klass.to_str }
|
131
131
|
|
132
|
-
it "represents
|
132
|
+
it "represents settings class in a human-friendly manner" do
|
133
133
|
expect(subject).to eq "Test::Api.users.update"
|
134
134
|
end
|
135
135
|
end
|
@@ -230,7 +230,7 @@ RSpec.describe Evil::Client::Settings do
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
context "with
|
233
|
+
context "with unparsable value" do
|
234
234
|
let(:value) { "foo" }
|
235
235
|
|
236
236
|
it "raises ArgumentError" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evil-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kozin (nepalez)
|
@@ -9,8 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: base64
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.2.0
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0.3'
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.2.0
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.3'
|
14
34
|
- !ruby/object:Gem::Dependency
|
15
35
|
name: dry-initializer
|
16
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,6 +216,7 @@ files:
|
|
196
216
|
- docs/license.md
|
197
217
|
- docs/rspec.md
|
198
218
|
- evil-client.gemspec
|
219
|
+
- lefthook.yml
|
199
220
|
- lib/evil-client.rb
|
200
221
|
- lib/evil/client.rb
|
201
222
|
- lib/evil/client/builder.rb
|
@@ -308,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
308
329
|
- !ruby/object:Gem::Version
|
309
330
|
version: '0'
|
310
331
|
requirements: []
|
311
|
-
rubygems_version: 3.
|
332
|
+
rubygems_version: 3.5.5
|
312
333
|
signing_key:
|
313
334
|
specification_version: 4
|
314
335
|
summary: Human-friendly DSL for building HTTP(s) clients in Ruby
|