rspec_request_helpers 0.2.1 → 0.2.2
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/Gemfile.lock +23 -23
- data/README.md +2 -2
- data/lib/generators/rspec/endpoint/USAGE +2 -2
- data/lib/generators/rspec/endpoint/endpoint_generator.rb +3 -7
- data/lib/generators/rspec/endpoint/templates/action_request_spec.rb +3 -3
- data/lib/rspec_request_helpers/version.rb +1 -1
- data/lib/rspec_request_helpers.rb +0 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a2b752cf6f020d649c07a12e549ba667a0db2214279b7ddb7809d9fae73199
|
4
|
+
data.tar.gz: 1aa902bcbbaffff0296f97ef914d5c240e3a9602f20f81741f1fb725fd52e9b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6fd1f79d08964cd834bce43c3566172dae02f18945ac8f70c97677fa83ca028278fcaec0bc0f8248122282f72a906ce214e064b25a60b101141f39ea1b415a
|
7
|
+
data.tar.gz: 53a2da32f5870d69c1c412dc728bbe3d803ea5b463bf886d3d11db865ded0480425a57eefc0d3e9e7ae15d3997c3040805e3f28256dd166d5516a4e4a447a7b3
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec_request_helpers (0.2.
|
4
|
+
rspec_request_helpers (0.2.2)
|
5
5
|
actionpack (>= 3.0)
|
6
6
|
activesupport (>= 3.0)
|
7
7
|
factory_bot
|
@@ -13,20 +13,20 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
actionpack (5.2.1)
|
17
|
-
actionview (= 5.2.1)
|
18
|
-
activesupport (= 5.2.1)
|
16
|
+
actionpack (5.2.2.1)
|
17
|
+
actionview (= 5.2.2.1)
|
18
|
+
activesupport (= 5.2.2.1)
|
19
19
|
rack (~> 2.0)
|
20
20
|
rack-test (>= 0.6.3)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
22
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
-
actionview (5.2.1)
|
24
|
-
activesupport (= 5.2.1)
|
23
|
+
actionview (5.2.2.1)
|
24
|
+
activesupport (= 5.2.2.1)
|
25
25
|
builder (~> 3.1)
|
26
26
|
erubi (~> 1.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
28
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
29
|
-
activesupport (5.2.1)
|
29
|
+
activesupport (5.2.2.1)
|
30
30
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
31
|
i18n (>= 0.7, < 2)
|
32
32
|
minitest (~> 5.1)
|
@@ -34,28 +34,28 @@ GEM
|
|
34
34
|
ast (2.4.0)
|
35
35
|
builder (3.2.3)
|
36
36
|
coderay (1.1.2)
|
37
|
-
concurrent-ruby (1.
|
37
|
+
concurrent-ruby (1.1.5)
|
38
38
|
crass (1.0.4)
|
39
39
|
diff-lcs (1.3)
|
40
|
-
erubi (1.
|
41
|
-
factory_bot (
|
42
|
-
activesupport (>=
|
43
|
-
i18n (1.
|
40
|
+
erubi (1.8.0)
|
41
|
+
factory_bot (5.0.2)
|
42
|
+
activesupport (>= 4.2.0)
|
43
|
+
i18n (1.6.0)
|
44
44
|
concurrent-ruby (~> 1.0)
|
45
|
-
loofah (2.2.
|
45
|
+
loofah (2.2.3)
|
46
46
|
crass (~> 1.0.2)
|
47
47
|
nokogiri (>= 1.5.9)
|
48
48
|
method_source (0.9.0)
|
49
|
-
mini_portile2 (2.
|
49
|
+
mini_portile2 (2.4.0)
|
50
50
|
minitest (5.11.3)
|
51
|
-
nokogiri (1.
|
52
|
-
mini_portile2 (~> 2.
|
53
|
-
parser (2.
|
51
|
+
nokogiri (1.10.2)
|
52
|
+
mini_portile2 (~> 2.4.0)
|
53
|
+
parser (2.6.2.0)
|
54
54
|
ast (~> 2.4.0)
|
55
55
|
pry (0.11.3)
|
56
56
|
coderay (~> 1.1.0)
|
57
57
|
method_source (~> 0.9.0)
|
58
|
-
rack (2.0.
|
58
|
+
rack (2.0.6)
|
59
59
|
rack-test (1.1.0)
|
60
60
|
rack (>= 1.0, < 3)
|
61
61
|
rails-dom-testing (2.0.3)
|
@@ -63,9 +63,9 @@ GEM
|
|
63
63
|
nokogiri (>= 1.6)
|
64
64
|
rails-html-sanitizer (1.0.4)
|
65
65
|
loofah (~> 2.2, >= 2.2.2)
|
66
|
-
railties (5.2.1)
|
67
|
-
actionpack (= 5.2.1)
|
68
|
-
activesupport (= 5.2.1)
|
66
|
+
railties (5.2.2.1)
|
67
|
+
actionpack (= 5.2.2.1)
|
68
|
+
activesupport (= 5.2.2.1)
|
69
69
|
method_source
|
70
70
|
rake (>= 0.8.7)
|
71
71
|
thor (>= 0.19.0, < 2.0)
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
84
84
|
rspec-support (~> 3.8.0)
|
85
85
|
rspec-support (3.8.0)
|
86
|
-
thor (0.20.
|
86
|
+
thor (0.20.3)
|
87
87
|
thread_safe (0.3.6)
|
88
88
|
tzinfo (1.2.5)
|
89
89
|
thread_safe (~> 0.1)
|
@@ -98,4 +98,4 @@ DEPENDENCIES
|
|
98
98
|
rspec_request_helpers!
|
99
99
|
|
100
100
|
BUNDLED WITH
|
101
|
-
1.
|
101
|
+
1.17.2
|
data/README.md
CHANGED
@@ -103,11 +103,11 @@ end
|
|
103
103
|
|
104
104
|
### Generate new rspec file for API endpoint
|
105
105
|
|
106
|
-
$ rails g rspec:endpoint <action name>
|
106
|
+
$ rails g rspec:endpoint <action name>
|
107
107
|
|
108
108
|
Example:
|
109
109
|
|
110
|
-
$ rails g rspec:endpoint
|
110
|
+
$ rails g rspec:endpoint api/v1/users/show
|
111
111
|
|
112
112
|
## Development
|
113
113
|
|
@@ -2,7 +2,7 @@ Description:
|
|
2
2
|
Generate a spec/requests file for specified action of controller
|
3
3
|
|
4
4
|
Example:
|
5
|
-
rails generate rspec:endpoint create
|
5
|
+
rails generate rspec:endpoint users/create
|
6
6
|
|
7
7
|
This will create:
|
8
|
-
|
8
|
+
spec/requests/users/create_spec.rb
|
@@ -1,9 +1,5 @@
|
|
1
1
|
module Rspec
|
2
2
|
class EndpointGenerator < Rails::Generators::NamedBase
|
3
|
-
desc 'Generate a spec/requests file for specified action of controller'
|
4
|
-
|
5
|
-
argument :controller, type: :string, required: true, banner: 'CONTOLLER'
|
6
|
-
|
7
3
|
source_root File.expand_path('../templates', __FILE__)
|
8
4
|
|
9
5
|
# https://www.rubytapas.com/2012/11/28/episode-029-redirecting-output/
|
@@ -20,15 +16,15 @@ module Rspec
|
|
20
16
|
def copy_files
|
21
17
|
Rails.application.load_tasks
|
22
18
|
routes = capture_output { Rake::Task['routes'].invoke }
|
23
|
-
@route = routes.split("\n").grep(Regexp.new "#{
|
19
|
+
@route = routes.split("\n").grep(Regexp.new "#{class_path.join('/')}##{file_name}").first || raise("#{class_path.join('/')}##{file_name} not found in routes")
|
24
20
|
@http_verb = @route[/GET|POST|DELETE|PUT|PATCH/]
|
25
21
|
@path = @route[/(\/.*)\(/, 1]
|
26
22
|
@path_params = @path.split('/').select{|i| i[/:/]}
|
27
23
|
@path_params.each do |param|
|
28
24
|
@path.sub!(param, '#{' + param[1..-1] + '}')
|
29
25
|
end
|
30
|
-
empty_directory
|
31
|
-
template 'action_request_spec.rb', "spec/requests/#{
|
26
|
+
empty_directory Pathname.new('spec/requests').join(*class_path)
|
27
|
+
template 'action_request_spec.rb', "spec/requests/#{file_path}_spec.rb"
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -3,11 +3,11 @@ RSpec.describe '', type: :request do
|
|
3
3
|
<%= "let(#{param}) { #{rand(99..500)} }" %>
|
4
4
|
<% end %>
|
5
5
|
path { "<%= @path %>" }
|
6
|
-
|
7
|
-
|
6
|
+
headers { {} }
|
7
|
+
params { {} }
|
8
8
|
expected_response { {} }
|
9
9
|
|
10
|
-
describe '<%= @http_verb.upcase %> <%=
|
10
|
+
describe '<%= @http_verb.upcase %> <%= class_path.join('/') %>#<%= file_name %>' do
|
11
11
|
context '' do
|
12
12
|
xit 'renders correct response' do
|
13
13
|
do_<%= @http_verb.downcase %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_request_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrii Baran
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -198,8 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
- !ruby/object:Gem::Version
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
|
-
|
202
|
-
rubygems_version: 2.7.6
|
201
|
+
rubygems_version: 3.0.1
|
203
202
|
signing_key:
|
204
203
|
specification_version: 4
|
205
204
|
summary: A set of helpers for request test with RSpec
|