rspec-request_describer 0.3.1 → 0.4.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/test.yml +17 -0
- data/CHANGELOG.md +16 -5
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -48
- data/README.md +31 -14
- data/lib/rspec/request_describer/version.rb +1 -1
- data/lib/rspec/request_describer.rb +1 -0
- data/rspec-request_describer.gemspec +0 -4
- metadata +5 -48
- data/.circleci/config.yml +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f663222473fe59484bc2e7b66a12a0f00edbd594fe8c7213b25e65c09e301b5e
|
4
|
+
data.tar.gz: ff27bc035f85f243c1fbd9724f215329b700cabb963e99a23d3a795226c5d868
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f0580c22c26f5c1d3ce15f7f14d7e24fba46bfb7b471b5d84c7d634965f5d981e467740e1484e6bfc5a081176439e0e608fcd151de317c673c8870e9d7c535
|
7
|
+
data.tar.gz: 219b07cde7c240ba1a2b42cb5ba433c7fec176f5bc32397ca09389dd774a3b214539f5e35d03410b0a9bdeb902fe339c2513aa2a7696fc46f8b14bd103a43db9
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
rspec:
|
11
|
+
uses: r7kamura/workflows/.github/workflows/ruby-rspec.yml@main
|
12
|
+
with:
|
13
|
+
ruby-version: 2.7.4
|
14
|
+
rubocop:
|
15
|
+
uses: r7kamura/workflows/.github/workflows/ruby-rubocop.yml@main
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7.4
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
## Unreleased
|
4
4
|
|
5
|
-
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
5
|
+
## 0.4.0 - 2023-07-10
|
7
6
|
|
8
|
-
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Support HEAD HTTP method.
|
10
|
+
|
11
|
+
## 0.3.2 - 2020-02-15
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
|
15
|
+
- Remove runtime gem dependency on actionpack.
|
16
|
+
|
17
|
+
## 0.3.1 - 2019-05-08
|
18
|
+
|
19
|
+
### Fixed
|
9
20
|
|
10
21
|
- Fix env calculation timing.
|
11
22
|
|
12
|
-
##
|
23
|
+
## 0.3.0 - 2019-05-05
|
13
24
|
|
14
25
|
### Added
|
15
26
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,60 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-request_describer (0.
|
5
|
-
actionpack (>= 5.0.0)
|
4
|
+
rspec-request_describer (0.4.0)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
|
-
actionpack (5.2.2)
|
11
|
-
actionview (= 5.2.2)
|
12
|
-
activesupport (= 5.2.2)
|
13
|
-
rack (~> 2.0)
|
14
|
-
rack-test (>= 0.6.3)
|
15
|
-
rails-dom-testing (~> 2.0)
|
16
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
17
|
-
actionview (5.2.2)
|
18
|
-
activesupport (= 5.2.2)
|
19
|
-
builder (~> 3.1)
|
20
|
-
erubi (~> 1.4)
|
21
|
-
rails-dom-testing (~> 2.0)
|
22
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
23
|
-
activesupport (5.2.2)
|
24
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
|
-
i18n (>= 0.7, < 2)
|
26
|
-
minitest (~> 5.1)
|
27
|
-
tzinfo (~> 1.1)
|
28
9
|
ast (2.4.0)
|
29
|
-
builder (3.2.3)
|
30
|
-
concurrent-ruby (1.1.3)
|
31
|
-
crass (1.0.4)
|
32
10
|
diff-lcs (1.3)
|
33
|
-
erubi (1.7.1)
|
34
|
-
i18n (1.1.1)
|
35
|
-
concurrent-ruby (~> 1.0)
|
36
11
|
jaro_winkler (1.5.1)
|
37
|
-
loofah (2.2.3)
|
38
|
-
crass (~> 1.0.2)
|
39
|
-
nokogiri (>= 1.5.9)
|
40
|
-
mini_portile2 (2.3.0)
|
41
|
-
minitest (5.11.3)
|
42
|
-
nokogiri (1.8.5)
|
43
|
-
mini_portile2 (~> 2.3.0)
|
44
12
|
parallel (1.12.1)
|
45
13
|
parser (2.5.3.0)
|
46
14
|
ast (~> 2.4.0)
|
47
15
|
powerpack (0.1.2)
|
48
|
-
rack (2.0.6)
|
49
|
-
rack-test (1.1.0)
|
50
|
-
rack (>= 1.0, < 3)
|
51
|
-
rails-dom-testing (2.0.3)
|
52
|
-
activesupport (>= 4.2.0)
|
53
|
-
nokogiri (>= 1.6)
|
54
|
-
rails-html-sanitizer (1.0.4)
|
55
|
-
loofah (~> 2.2, >= 2.2.2)
|
56
16
|
rainbow (3.0.0)
|
57
|
-
rake (
|
17
|
+
rake (13.0.1)
|
58
18
|
rspec (3.8.0)
|
59
19
|
rspec-core (~> 3.8.0)
|
60
20
|
rspec-expectations (~> 3.8.0)
|
@@ -77,20 +37,16 @@ GEM
|
|
77
37
|
ruby-progressbar (~> 1.7)
|
78
38
|
unicode-display_width (~> 1.4.0)
|
79
39
|
ruby-progressbar (1.10.0)
|
80
|
-
thread_safe (0.3.6)
|
81
|
-
tzinfo (1.2.5)
|
82
|
-
thread_safe (~> 0.1)
|
83
40
|
unicode-display_width (1.4.0)
|
84
41
|
|
85
42
|
PLATFORMS
|
86
43
|
ruby
|
87
44
|
|
88
45
|
DEPENDENCIES
|
89
|
-
|
90
|
-
rake (~> 10.0)
|
46
|
+
rake
|
91
47
|
rspec
|
92
48
|
rspec-request_describer!
|
93
49
|
rubocop
|
94
50
|
|
95
51
|
BUNDLED WITH
|
96
|
-
|
52
|
+
2.2.29
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RSpec::RequestDescriber
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![test](https://github.com/r7kamura/rspec-request_describer/actions/workflows/test.yml/badge.svg)](https://github.com/r7kamura/rspec-request_describer/actions/workflows/test.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/rspec-request_describer.svg)](https://rubygems.org/gems/rspec-request_describer)
|
5
5
|
|
6
6
|
An RSpec plugin to write self-documenting request-specs.
|
@@ -39,11 +39,15 @@ Include `RSpec::RequestDescriber` to your example groups like this:
|
|
39
39
|
```ruby
|
40
40
|
require 'rspec/request_describer'
|
41
41
|
|
42
|
-
RSpec.
|
42
|
+
RSpec.configure do |config|
|
43
|
+
config.include RSpec::RequestDescriber, type: :request
|
44
|
+
end
|
43
45
|
```
|
44
46
|
|
45
47
|
## Usage
|
46
48
|
|
49
|
+
Note that this is an example in a Rails app.
|
50
|
+
|
47
51
|
### subject
|
48
52
|
|
49
53
|
`RSpec::RequestDescriber` provides `subject` from its top-level description.
|
@@ -51,7 +55,10 @@ RSpec.configuration.include RSpec::RequestDescriber, type: :request
|
|
51
55
|
```ruby
|
52
56
|
# subject will be `get('/users')`.
|
53
57
|
RSpec.describe 'GET /users' do
|
54
|
-
it
|
58
|
+
it 'returns 200' do
|
59
|
+
subject
|
60
|
+
expect(response).to have_http_status(200)
|
61
|
+
end
|
55
62
|
end
|
56
63
|
```
|
57
64
|
|
@@ -66,7 +73,11 @@ RSpec.describe 'GET /users' do
|
|
66
73
|
before do
|
67
74
|
headers['Authorization'] = 'token 12345'
|
68
75
|
end
|
69
|
-
|
76
|
+
|
77
|
+
it 'returns 200' do
|
78
|
+
subject
|
79
|
+
expect(response).to have_http_status(200)
|
80
|
+
end
|
70
81
|
end
|
71
82
|
end
|
72
83
|
```
|
@@ -83,21 +94,24 @@ RSpec.describe 'GET /users' do
|
|
83
94
|
params['sort'] = 'id'
|
84
95
|
end
|
85
96
|
|
86
|
-
it 'returns
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
97
|
+
it 'returns 200 with expected JSON body' do
|
98
|
+
subject
|
99
|
+
expect(response).to have_http_status(200)
|
100
|
+
expect(response.parsed_body).to match(
|
101
|
+
[
|
102
|
+
hash_including('id' => 1),
|
103
|
+
hash_including('id' => 2),
|
104
|
+
]
|
105
|
+
)
|
92
106
|
end
|
93
107
|
end
|
94
108
|
end
|
95
109
|
```
|
96
110
|
|
97
|
-
###
|
111
|
+
### path parameters
|
98
112
|
|
99
|
-
You can embed variables in URL path like `/users/:
|
100
|
-
In this example, the returned value of `
|
113
|
+
You can embed variables in URL path like `/users/:user_id`.
|
114
|
+
In this example, the returned value of `user_id` method will be emobeded as its real value.
|
101
115
|
|
102
116
|
```ruby
|
103
117
|
# `subject` will be `get("/users/#{user_id}")`.
|
@@ -110,6 +124,9 @@ RSpec.describe 'GET /users/:user_id' do
|
|
110
124
|
user.id
|
111
125
|
end
|
112
126
|
|
113
|
-
it
|
127
|
+
it 'returns 200' do
|
128
|
+
subject
|
129
|
+
expect(response).to have_http_status(200)
|
130
|
+
end
|
114
131
|
end
|
115
132
|
```
|
@@ -15,8 +15,4 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ['lib']
|
18
|
-
|
19
|
-
spec.add_dependency 'actionpack', '>= 5.0.0'
|
20
|
-
spec.add_development_dependency 'bundler', '~> 1.7'
|
21
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
22
18
|
end
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-request_describer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: actionpack
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 5.0.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 5.0.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.7'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.7'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '10.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '10.0'
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description:
|
56
14
|
email:
|
57
15
|
- r7kamura@gmail.com
|
@@ -59,7 +17,7 @@ executables: []
|
|
59
17
|
extensions: []
|
60
18
|
extra_rdoc_files: []
|
61
19
|
files:
|
62
|
-
- ".
|
20
|
+
- ".github/workflows/test.yml"
|
63
21
|
- ".gitignore"
|
64
22
|
- ".rspec"
|
65
23
|
- ".rubocop.yml"
|
@@ -93,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
51
|
- !ruby/object:Gem::Version
|
94
52
|
version: '0'
|
95
53
|
requirements: []
|
96
|
-
|
97
|
-
rubygems_version: 2.7.6
|
54
|
+
rubygems_version: 3.3.26
|
98
55
|
signing_key:
|
99
56
|
specification_version: 4
|
100
57
|
summary: An RSpec plugin to write self-documenting request-specs.
|
data/.circleci/config.yml
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
jobs:
|
2
|
-
rspec:
|
3
|
-
docker:
|
4
|
-
- image: ruby:2.5.3
|
5
|
-
steps:
|
6
|
-
- checkout
|
7
|
-
- restore_cache:
|
8
|
-
keys:
|
9
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
10
|
-
- v1-dependencies-
|
11
|
-
- run:
|
12
|
-
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
13
|
-
name: bundle install
|
14
|
-
- save_cache:
|
15
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
16
|
-
paths:
|
17
|
-
- ./vendor/bundle
|
18
|
-
- run:
|
19
|
-
command: bundle exec rspec
|
20
|
-
name: rspec
|
21
|
-
rubocop:
|
22
|
-
docker:
|
23
|
-
- image: ruby:2.5.3
|
24
|
-
steps:
|
25
|
-
- checkout
|
26
|
-
- restore_cache:
|
27
|
-
keys:
|
28
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
29
|
-
- v1-dependencies-
|
30
|
-
- run:
|
31
|
-
command: bundle install --jobs=4 --retry=3 --path vendor/bundle
|
32
|
-
name: bundle install
|
33
|
-
- save_cache:
|
34
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
35
|
-
paths:
|
36
|
-
- ./vendor/bundle
|
37
|
-
- run:
|
38
|
-
command: bundle exec rubocop
|
39
|
-
name: rubocop
|
40
|
-
version: 2
|
41
|
-
workflows:
|
42
|
-
version: 2
|
43
|
-
test:
|
44
|
-
jobs:
|
45
|
-
- rspec
|
46
|
-
- rubocop
|