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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0b78ac4f439eb1d0ed6fba9883a0db62492dfaea
4
- data.tar.gz: bd6caaced45e902dcfe04c9a0f76114c4a13b274
2
+ SHA256:
3
+ metadata.gz: bbb219ecf8e5bb234b68944356a82fd4e6a9ed160e06aa28ad8fee5f750507b3
4
+ data.tar.gz: 43ee6b654b6e6fc771ccd1fcad18bc18e824051704ed468769d39e4c7c62be2e
5
5
  SHA512:
6
- metadata.gz: e9319d0bc63e4154724305fd7153c6282b2fdd1bc54d806214300a8e674f073873aa844bec86fc3e93f83a79583d383c615b28a6da2b96d562548eeb8f110d1b
7
- data.tar.gz: 0895baa44cc05fe24d55fbabdbe8a82b1884eaf0a36bf07723c96ea514f6ef3ddeed78d47b0cd6d6249bf049e62c98a2143f8a008fb625f6c0b0141b1c553b9c
6
+ metadata.gz: ddb0d38882b29adebfdfdaa53cf0f615cd187382628fd80e5796caabe4ea7611fa215508437fcd8000a707debd20317dfcbdf2d44db90001f70bc39cc61b612b
7
+ data.tar.gz: b3431282a1254fb33fcfd7d913585da607531f7d5736f7957854d1f4d0fda0aaf0dd399b8c2d3c42fd709ee248b6e87dd25b1fcef3d953f429c1466438f98b16
@@ -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
@@ -0,0 +1,11 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ release:
10
+ uses: r7kamura/workflows/.github/workflows/gem-release.yml@main
11
+ if: github.repository_owner == 'r7kamura'
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in response_code_matchers.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake'
7
+ gem 'rspec'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ResponseCodeMatchers [![Build Status](https://travis-ci.org/r7kamura/response_code_matchers.svg?branch=master)](https://travis-ci.org/r7kamura/response_code_matchers)
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, but 400
75
+ expected response code to be 404, got 400
76
76
  ```
77
77
 
78
78
 
@@ -1,3 +1,3 @@
1
1
  module ResponseCodeMatchers
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -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, but #@actual"
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, but #@actual"
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 be_payload_too_large
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 be_unprocessable_entity
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.1.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: 2015-02-18 00:00:00.000000000 Z
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
- metadata: {}
66
- post_install_message:
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: '0'
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
- rubyforge_project:
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
@@ -1,7 +0,0 @@
1
- language: ruby
2
- gemfile:
3
- - gemfiles/rspec-2.14.gemfile
4
- - gemfiles/rspec-3.0.gemfile
5
- - gemfiles/rspec-2.99.gemfile
6
-
7
- script: 'bundle exec rspec'
data/CHANGELOG.md DELETED
@@ -1,14 +0,0 @@
1
- ## 0.1.0
2
- - Change required interface on test target
3
-
4
- ## 0.0.4
5
- - Support RSpec 3
6
-
7
- ## 0.0.3
8
- - Support Rack::MockResponse
9
-
10
- ## 0.0.2
11
- - Fix bugs
12
-
13
- ## 0.0.1
14
- - 1st Release
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rspec', '~> 2.14.0'
4
-
5
- gemspec path: '../'
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rspec', '~> 2.99.0.beta1'
4
-
5
- gemspec path: '../'
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'rspec', '~> 3.0.0.beta1'
4
-
5
- gemspec path: '../'