response_code_matchers 0.1.0 → 0.2.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 +5 -5
- data/.github/release.yml +23 -0
- data/.github/workflows/actions.lock +37 -0
- data/.github/workflows/bump-request.yml +26 -0
- data/.github/workflows/ci.yml +24 -0
- data/.github/workflows/release.yml +11 -0
- data/Gemfile +3 -0
- data/README.md +2 -2
- data/lib/response_code_matchers/version.rb +1 -1
- data/lib/response_code_matchers.rb +18 -2
- data/response_code_matchers.gemspec +5 -1
- data/spec/response_code_matchers_spec.rb +2 -3
- metadata +14 -30
- data/.travis.yml +0 -7
- data/CHANGELOG.md +0 -14
- data/gemfiles/rspec-2.14.gemfile +0 -5
- data/gemfiles/rspec-2.99.gemfile +0 -5
- data/gemfiles/rspec-3.0.gemfile +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: bbb219ecf8e5bb234b68944356a82fd4e6a9ed160e06aa28ad8fee5f750507b3
|
|
4
|
+
data.tar.gz: 43ee6b654b6e6fc771ccd1fcad18bc18e824051704ed468769d39e4c7c62be2e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddb0d38882b29adebfdfdaa53cf0f615cd187382628fd80e5796caabe4ea7611fa215508437fcd8000a707debd20317dfcbdf2d44db90001f70bc39cc61b612b
|
|
7
|
+
data.tar.gz: b3431282a1254fb33fcfd7d913585da607531f7d5736f7957854d1f4d0fda0aaf0dd399b8c2d3c42fd709ee248b6e87dd25b1fcef3d953f429c1466438f98b16
|
data/.github/release.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
changelog:
|
|
2
|
+
categories:
|
|
3
|
+
- title: Added
|
|
4
|
+
labels:
|
|
5
|
+
- add
|
|
6
|
+
- title: Changed
|
|
7
|
+
labels:
|
|
8
|
+
- change
|
|
9
|
+
- title: Deprecated
|
|
10
|
+
labels:
|
|
11
|
+
- deprecate
|
|
12
|
+
- title: Fixed
|
|
13
|
+
labels:
|
|
14
|
+
- fix
|
|
15
|
+
- title: Removed
|
|
16
|
+
labels:
|
|
17
|
+
- remove
|
|
18
|
+
- title: Security
|
|
19
|
+
labels:
|
|
20
|
+
- security
|
|
21
|
+
- title: Others
|
|
22
|
+
labels:
|
|
23
|
+
- "*"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This file is machine-generated by `gh actions-lock`.
|
|
2
|
+
# Do not edit by hand; run `gh actions-lock` to update.
|
|
3
|
+
# Docs: https://gh.io/actions-lockfile
|
|
4
|
+
version: 'v0.0.3'
|
|
5
|
+
workflows:
|
|
6
|
+
'.github/workflows/bump-request.yml':
|
|
7
|
+
- 'actions/checkout@v7.0.1'
|
|
8
|
+
- 'r7kamura/bump-request@v0.7.1'
|
|
9
|
+
- 'ruby/setup-ruby@v1.336.0'
|
|
10
|
+
'.github/workflows/ci.yml':
|
|
11
|
+
- 'actions/checkout@v7.0.1'
|
|
12
|
+
- 'ruby/setup-ruby@v1.336.0'
|
|
13
|
+
'.github/workflows/release.yml': []
|
|
14
|
+
dependencies:
|
|
15
|
+
'actions/checkout@v7.0.1':
|
|
16
|
+
ref: 'v7.0.1'
|
|
17
|
+
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
|
|
18
|
+
owner_id: 44036562
|
|
19
|
+
repo_id: 197814629
|
|
20
|
+
'actions/setup-node@v7.1.0':
|
|
21
|
+
ref: 'v7.1.0'
|
|
22
|
+
commit: 'sha1-949feb2413d6458794dcd2491c4babbbce0c15c1'
|
|
23
|
+
owner_id: 44036562
|
|
24
|
+
repo_id: 189476904
|
|
25
|
+
'r7kamura/bump-request@v0.7.1':
|
|
26
|
+
ref: 'v0.7.1'
|
|
27
|
+
commit: 'sha1-b27937188d404bc0c2fd442403e6de1d20f9b349'
|
|
28
|
+
owner_id: 111689
|
|
29
|
+
repo_id: 533135195
|
|
30
|
+
uses:
|
|
31
|
+
- 'actions/checkout@v7.0.1'
|
|
32
|
+
- 'actions/setup-node@v7.1.0'
|
|
33
|
+
'ruby/setup-ruby@v1.336.0':
|
|
34
|
+
ref: 'v1.336.0'
|
|
35
|
+
commit: 'sha1-de492cf36cbab201753d720ce4f4e336cd688c94'
|
|
36
|
+
owner_id: 210414
|
|
37
|
+
repo_id: 231208785
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: bump-request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
version:
|
|
7
|
+
description: Version to change to.
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
run:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7.0.1
|
|
16
|
+
- name: Set up Ruby
|
|
17
|
+
uses: ruby/setup-ruby@v1.336.0
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: 3.3
|
|
20
|
+
bundler-cache: true
|
|
21
|
+
- uses: r7kamura/bump-request@v0.7.1
|
|
22
|
+
with:
|
|
23
|
+
command: |
|
|
24
|
+
sed -i -r 's/([0-9]+\.[0-9]+\.[0-9]+)/${{ inputs.version }}/' lib/response_code_matchers/version.rb
|
|
25
|
+
bundle install
|
|
26
|
+
version: ${{ inputs.version }}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
name: Ruby ${{ matrix.ruby }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby: ['3.3', '3.4', '4.0']
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7.0.1
|
|
19
|
+
- name: Set up Ruby
|
|
20
|
+
uses: ruby/setup-ruby@v1.336.0
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
- run: bundle exec rspec
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ResponseCodeMatchers
|
|
1
|
+
# ResponseCodeMatchers
|
|
2
2
|
Provide rspec matchers to match http response code.
|
|
3
3
|
The receiver of this matcher should have `#code` or `#status` method which returns http status code,
|
|
4
4
|
and `#header` and `#headers` methods.
|
|
@@ -72,7 +72,7 @@ There are 2 advantages to use this gem.
|
|
|
72
72
|
expected not_found? to return true, got false
|
|
73
73
|
|
|
74
74
|
# with response_code_matchers.gem
|
|
75
|
-
expected response code to be 404,
|
|
75
|
+
expected response code to be 404, got 400
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
|
|
@@ -14,6 +14,22 @@ module ResponseCodeMatchers
|
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Compatibility matchers for status names that were renamed or removed in Rack 3.1.
|
|
18
|
+
# Each is defined only when Rack no longer provides a matcher with that name.
|
|
19
|
+
LEGACY_MATCHERS = {
|
|
20
|
+
"payload_too_large" => [413, "content_too_large"],
|
|
21
|
+
"unprocessable_entity" => [422, "unprocessable_content"],
|
|
22
|
+
"not_extended" => [510, "not_extended"],
|
|
23
|
+
}.freeze
|
|
24
|
+
|
|
25
|
+
LEGACY_MATCHERS.each do |legacy_name, (code, name)|
|
|
26
|
+
next if method_defined?("be_#{legacy_name}")
|
|
27
|
+
|
|
28
|
+
define_method("be_#{legacy_name}") do
|
|
29
|
+
ResponseCodeMatcher.new(code.to_s, name)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
17
33
|
class ResponseCodeMatcher
|
|
18
34
|
def initialize(expected, name)
|
|
19
35
|
@expected = expected
|
|
@@ -40,7 +56,7 @@ module ResponseCodeMatchers
|
|
|
40
56
|
|
|
41
57
|
def failure_message
|
|
42
58
|
if @valid
|
|
43
|
-
"expected response code to be #@expected,
|
|
59
|
+
"expected response code to be #@expected, got #@actual"
|
|
44
60
|
else
|
|
45
61
|
"expected #{method_name} to return true, got false"
|
|
46
62
|
end
|
|
@@ -48,7 +64,7 @@ module ResponseCodeMatchers
|
|
|
48
64
|
|
|
49
65
|
def failure_message_when_negated
|
|
50
66
|
if @valid
|
|
51
|
-
"expected response code not to be #@expected,
|
|
67
|
+
"expected response code not to be #@expected, got #@actual"
|
|
52
68
|
else
|
|
53
69
|
"expected #{method_name} to return false, got true"
|
|
54
70
|
end
|
|
@@ -11,6 +11,11 @@ Gem::Specification.new do |gem|
|
|
|
11
11
|
gem.description = "Provide rspec matchers to match http response code"
|
|
12
12
|
gem.summary = "RSpec utility matchers for http response code"
|
|
13
13
|
gem.homepage = "https://github.com/r7kamura/response_code_matchers"
|
|
14
|
+
gem.license = "MIT"
|
|
15
|
+
gem.required_ruby_version = ">= 3.3"
|
|
16
|
+
|
|
17
|
+
gem.metadata["rubygems_mfa_required"] = "true"
|
|
18
|
+
gem.metadata["source_code_uri"] = gem.homepage
|
|
14
19
|
|
|
15
20
|
gem.files = `git ls-files`.split($/)
|
|
16
21
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
@@ -18,5 +23,4 @@ Gem::Specification.new do |gem|
|
|
|
18
23
|
gem.require_paths = ["lib"]
|
|
19
24
|
|
|
20
25
|
gem.add_dependency "rack"
|
|
21
|
-
gem.add_development_dependency "rspec"
|
|
22
26
|
end
|
|
@@ -34,12 +34,12 @@ describe ResponseCodeMatchers do
|
|
|
34
34
|
410 be_gone
|
|
35
35
|
411 be_length_required
|
|
36
36
|
412 be_precondition_failed
|
|
37
|
-
413
|
|
37
|
+
413 be_content_too_large
|
|
38
38
|
414 be_uri_too_long
|
|
39
39
|
415 be_unsupported_media_type
|
|
40
40
|
416 be_range_not_satisfiable
|
|
41
41
|
417 be_expectation_failed
|
|
42
|
-
422
|
|
42
|
+
422 be_unprocessable_content
|
|
43
43
|
423 be_locked
|
|
44
44
|
424 be_failed_dependency
|
|
45
45
|
426 be_upgrade_required
|
|
@@ -51,7 +51,6 @@ describe ResponseCodeMatchers do
|
|
|
51
51
|
505 be_http_version_not_supported
|
|
52
52
|
506 be_variant_also_negotiates
|
|
53
53
|
507 be_insufficient_storage
|
|
54
|
-
510 be_not_extended
|
|
55
54
|
].each_slice(2) do |code, matcher|
|
|
56
55
|
describe "##{matcher}" do
|
|
57
56
|
let(:response) do
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: response_code_matchers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryo NAKAMURA
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rack
|
|
@@ -24,20 +23,6 @@ dependencies:
|
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rspec
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
26
|
description: Provide rspec matchers to match http response code
|
|
42
27
|
email:
|
|
43
28
|
- r7kamura@gmail.com
|
|
@@ -45,25 +30,27 @@ executables: []
|
|
|
45
30
|
extensions: []
|
|
46
31
|
extra_rdoc_files: []
|
|
47
32
|
files:
|
|
33
|
+
- ".github/release.yml"
|
|
34
|
+
- ".github/workflows/actions.lock"
|
|
35
|
+
- ".github/workflows/bump-request.yml"
|
|
36
|
+
- ".github/workflows/ci.yml"
|
|
37
|
+
- ".github/workflows/release.yml"
|
|
48
38
|
- ".gitignore"
|
|
49
|
-
- ".travis.yml"
|
|
50
|
-
- CHANGELOG.md
|
|
51
39
|
- Gemfile
|
|
52
40
|
- LICENSE.txt
|
|
53
41
|
- README.md
|
|
54
42
|
- Rakefile
|
|
55
|
-
- gemfiles/rspec-2.14.gemfile
|
|
56
|
-
- gemfiles/rspec-2.99.gemfile
|
|
57
|
-
- gemfiles/rspec-3.0.gemfile
|
|
58
43
|
- lib/response_code_matchers.rb
|
|
59
44
|
- lib/response_code_matchers/version.rb
|
|
60
45
|
- response_code_matchers.gemspec
|
|
61
46
|
- spec/response_code_matchers_spec.rb
|
|
62
47
|
- spec/spec_helper.rb
|
|
63
48
|
homepage: https://github.com/r7kamura/response_code_matchers
|
|
64
|
-
licenses:
|
|
65
|
-
|
|
66
|
-
|
|
49
|
+
licenses:
|
|
50
|
+
- MIT
|
|
51
|
+
metadata:
|
|
52
|
+
rubygems_mfa_required: 'true'
|
|
53
|
+
source_code_uri: https://github.com/r7kamura/response_code_matchers
|
|
67
54
|
rdoc_options: []
|
|
68
55
|
require_paths:
|
|
69
56
|
- lib
|
|
@@ -71,19 +58,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
71
58
|
requirements:
|
|
72
59
|
- - ">="
|
|
73
60
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
61
|
+
version: '3.3'
|
|
75
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
63
|
requirements:
|
|
77
64
|
- - ">="
|
|
78
65
|
- !ruby/object:Gem::Version
|
|
79
66
|
version: '0'
|
|
80
67
|
requirements: []
|
|
81
|
-
|
|
82
|
-
rubygems_version: 2.4.5
|
|
83
|
-
signing_key:
|
|
68
|
+
rubygems_version: 4.0.20
|
|
84
69
|
specification_version: 4
|
|
85
70
|
summary: RSpec utility matchers for http response code
|
|
86
71
|
test_files:
|
|
87
72
|
- spec/response_code_matchers_spec.rb
|
|
88
73
|
- spec/spec_helper.rb
|
|
89
|
-
has_rdoc:
|
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
data/gemfiles/rspec-2.14.gemfile
DELETED
data/gemfiles/rspec-2.99.gemfile
DELETED