rspec-request_describer 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f663222473fe59484bc2e7b66a12a0f00edbd594fe8c7213b25e65c09e301b5e
4
- data.tar.gz: ff27bc035f85f243c1fbd9724f215329b700cabb963e99a23d3a795226c5d868
3
+ metadata.gz: 813d1506690f4cf7e4d0857dcdf1435fef147991f7ed62c38bf84c9cde8b7939
4
+ data.tar.gz: 0f4344c220644c8219596c95131fa0a39b550ed1495c93a438cd04f5e5f86f1f
5
5
  SHA512:
6
- metadata.gz: f4f0580c22c26f5c1d3ce15f7f14d7e24fba46bfb7b471b5d84c7d634965f5d981e467740e1484e6bfc5a081176439e0e608fcd151de317c673c8870e9d7c535
7
- data.tar.gz: 219b07cde7c240ba1a2b42cb5ba433c7fec176f5bc32397ca09389dd774a3b214539f5e35d03410b0a9bdeb902fe339c2513aa2a7696fc46f8b14bd103a43db9
6
+ metadata.gz: b01cd40a7f9e7053ee8b513adb33457d64701eb5afe710ecc22e784f300710a14f822d99d6568bcb43a46ca79f73c8b8e0e2d09396bc344f43a97d474cd4a8b0
7
+ data.tar.gz: 6aee8e0079e15f6e16061ef34289a7d2c7271591cb65fccf3772c83c1db0a0832e2a47ba52586db6dea756abcce3bbec9cb9ad5d7b7b1fe326c7c6958ac981de
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.0 - 2024-03-28
6
+
7
+ ### Added
8
+
9
+ - Raise friendly error on incorrect `describe` usage.
10
+
5
11
  ## 0.4.0 - 2023-07-10
6
12
 
7
13
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-request_describer (0.4.0)
4
+ rspec-request_describer (0.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -3,7 +3,7 @@
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
- An RSpec plugin to write self-documenting request-specs.
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 emobeded as its real value.
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}")`.
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module RequestDescriber
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
@@ -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+)/).to_a
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.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: 2023-07-10 00:00:00.000000000 Z
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.3.26
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: