rspec-request_describer 0.4.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/rspec/request_describer/version.rb +1 -1
- data/lib/rspec/request_describer.rb +6 -1
- data/spec/rspec/request_describer_spec.rb +6 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813d1506690f4cf7e4d0857dcdf1435fef147991f7ed62c38bf84c9cde8b7939
|
4
|
+
data.tar.gz: 0f4344c220644c8219596c95131fa0a39b550ed1495c93a438cd04f5e5f86f1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b01cd40a7f9e7053ee8b513adb33457d64701eb5afe710ecc22e784f300710a14f822d99d6568bcb43a46ca79f73c8b8e0e2d09396bc344f43a97d474cd4a8b0
|
7
|
+
data.tar.gz: 6aee8e0079e15f6e16061ef34289a7d2c7271591cb65fccf3772c83c1db0a0832e2a47ba52586db6dea756abcce3bbec9cb9ad5d7b7b1fe326c7c6958ac981de
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](https://github.com/r7kamura/rspec-request_describer/actions/workflows/test.yml)
|
4
4
|
[](https://rubygems.org/gems/rspec-request_describer)
|
5
5
|
|
6
|
-
|
6
|
+
RSpec plugin to write self-documenting request-specs.
|
7
7
|
|
8
8
|
This gem is designed for:
|
9
9
|
|
@@ -111,7 +111,7 @@ end
|
|
111
111
|
### path parameters
|
112
112
|
|
113
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
|
114
|
+
In this example, the returned value of `user_id` method will be embedded as its real value.
|
115
115
|
|
116
116
|
```ruby
|
117
117
|
# `subject` will be `get("/users/#{user_id}")`.
|
@@ -2,6 +2,8 @@ require 'rspec/request_describer/version'
|
|
2
2
|
|
3
3
|
module RSpec
|
4
4
|
module RequestDescriber
|
5
|
+
class IncorrectDescribe < StandardError; end
|
6
|
+
|
5
7
|
RESERVED_HEADER_NAMES = %w[
|
6
8
|
content-type
|
7
9
|
host
|
@@ -62,7 +64,10 @@ module RSpec
|
|
62
64
|
|
63
65
|
let(:endpoint_segments) do
|
64
66
|
current_example = ::RSpec.respond_to?(:current_example) ? ::RSpec.current_example : example
|
65
|
-
current_example.full_description.match(/(#{::Regexp.union(SUPPORTED_METHODS)}) (\S+)/)
|
67
|
+
match = current_example.full_description.match(/(#{::Regexp.union(SUPPORTED_METHODS)}) (\S+)/)
|
68
|
+
raise IncorrectDescribe, 'Please use the format "METHOD /path" for the describe' unless match
|
69
|
+
|
70
|
+
match.to_a
|
66
71
|
end
|
67
72
|
|
68
73
|
# @return [String] e.g. `"get"`
|
@@ -138,4 +138,10 @@ RSpec.describe RSpec::RequestDescriber do
|
|
138
138
|
)
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
context 'when the test case is under the top-level describe unexpectedly' do
|
143
|
+
it 'handles the error' do
|
144
|
+
expect { subject }.to raise_error(RSpec::RequestDescriber::IncorrectDescribe)
|
145
|
+
end
|
146
|
+
end
|
141
147
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- r7kamura@gmail.com
|
16
16
|
executables: []
|
@@ -36,7 +36,7 @@ homepage: https://github.com/r7kamura/rspec-request_describer
|
|
36
36
|
licenses:
|
37
37
|
- MIT
|
38
38
|
metadata: {}
|
39
|
-
post_install_message:
|
39
|
+
post_install_message:
|
40
40
|
rdoc_options: []
|
41
41
|
require_paths:
|
42
42
|
- lib
|
@@ -51,8 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
|
-
rubygems_version: 3.
|
55
|
-
signing_key:
|
54
|
+
rubygems_version: 3.4.19
|
55
|
+
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: An RSpec plugin to write self-documenting request-specs.
|
58
58
|
test_files:
|