rspec_contracts 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rspec_contracts/contract.rb +1 -1
- data/lib/rspec_contracts/integration.rb +5 -1
- data/lib/rspec_contracts/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4054a2553651cf96248d039eaea4a792d267bce17552717159359d44f7f128ac
|
4
|
+
data.tar.gz: cfbb288db3943923e489f34614a1e5d4dff4fbda4f48c594f732d7f5fac4a514
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015e607d259d71a90f30c6e32c240189a318ae8504ddbf4efe865fbe0ddafd3f0d8c33952e4feaab22c5903d6cf6e4a375c730d4f5df5d728ff1ed3c48230d7e
|
7
|
+
data.tar.gz: b6d77cebe29dcce5c53a189590ac3ca0417b1b474fd0f24ea11c28c2ab24912fa93adef9d54d06acf31ae05e64b3591cae8afbe36adf9c01e359e93566ad8a6a
|
data/README.md
CHANGED
@@ -91,7 +91,7 @@ Version constraints accept the same format as bundler in your Gemfile, so all of
|
|
91
91
|
|
92
92
|
```ruby
|
93
93
|
let(:api_call) { get pets_path, api_operation: contract["findPets"], api_version: "~> 1.1.0" }
|
94
|
-
let(:api_call) { get pets_path, api_operation: contract["findPets"], api_version: ">= 1.1.0, < 2" }
|
94
|
+
let(:api_call) { get pets_path, api_operation: contract["findPets"], api_version: [">= 1.1.0", "< 2"] }
|
95
95
|
let(:api_call) { get pets_path, api_operation: contract["findPets"], api_version: "1.1.0" }
|
96
96
|
```
|
97
97
|
|
@@ -4,6 +4,10 @@ module RspecContracts
|
|
4
4
|
module Integration
|
5
5
|
http_verbs = %w[get post patch put delete]
|
6
6
|
|
7
|
+
def version_satisfied?(constraints, api_version)
|
8
|
+
Array(constraints).all? {|constraint| Semverse::Constraint.new(constraint).satisfies?(api_version) }
|
9
|
+
end
|
10
|
+
|
7
11
|
http_verbs.each do |method|
|
8
12
|
define_method(method) do |*args, **kwargs|
|
9
13
|
request_path = args.first
|
@@ -11,7 +15,7 @@ module RspecContracts
|
|
11
15
|
api_version = kwargs.delete(:api_version)
|
12
16
|
super(*args, **kwargs).tap do |status_code|
|
13
17
|
next unless api_operation # even a not found contract lookup will still be present
|
14
|
-
next if api_version.present? && !
|
18
|
+
next if api_version.present? && !version_satisfied?(api_version, api_operation.root.version)
|
15
19
|
raise RspecContracts::Error::OperationLookup.new("Operation not found") unless api_operation.valid?
|
16
20
|
|
17
21
|
RspecContracts.config.logger.tagged("rspec_contracts", api_operation.operation_id) do
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_contracts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "
|
19
|
+
version: 6.1.7
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 6.1.
|
22
|
+
version: 6.1.7.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
- - "
|
29
|
+
version: 6.1.7
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 6.1.
|
32
|
+
version: 6.1.7.3
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rspec-rails
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -311,7 +311,7 @@ files:
|
|
311
311
|
- lib/rspec_contracts/response_validator.rb
|
312
312
|
- lib/rspec_contracts/version.rb
|
313
313
|
- lib/tasks/rspec_contracts_tasks.rake
|
314
|
-
homepage: https://github.com/tractionguest/
|
314
|
+
homepage: https://github.com/tractionguest/rspec_contracts
|
315
315
|
licenses:
|
316
316
|
- MIT
|
317
317
|
metadata: {}
|
@@ -330,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
330
|
- !ruby/object:Gem::Version
|
331
331
|
version: '0'
|
332
332
|
requirements: []
|
333
|
-
rubygems_version: 3.
|
333
|
+
rubygems_version: 3.3.26
|
334
334
|
signing_key:
|
335
335
|
specification_version: 4
|
336
336
|
summary: Contract testing for Rspec requests
|