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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91adebd9c1dabd6ddca1e5cfcbdb89e99fb2206cda1ca33ab3d668394a196e45
4
- data.tar.gz: f66ddb343374709b07238a35307d678b8db57c085ca7692e35ea5534c5230418
3
+ metadata.gz: 90a2b752cf6f020d649c07a12e549ba667a0db2214279b7ddb7809d9fae73199
4
+ data.tar.gz: 1aa902bcbbaffff0296f97ef914d5c240e3a9602f20f81741f1fb725fd52e9b1
5
5
  SHA512:
6
- metadata.gz: a345f449c50de4de835926f81aa00b595a57c36f585b8673f4ad2c5f6cfa52824fc725f7c378c0b11d0925b0474b426c09e27242b2a1b4eb98c6b47d05a14aa8
7
- data.tar.gz: 6be451b2491f92893dd08d8a94df520a84f6272602d719991cb54f099e91793bb3d92f60c263b582dbd6564dea197d6ad71213ae2bac0d4db3bdc0abcc742592
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.1)
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.0.5)
37
+ concurrent-ruby (1.1.5)
38
38
  crass (1.0.4)
39
39
  diff-lcs (1.3)
40
- erubi (1.7.1)
41
- factory_bot (4.11.1)
42
- activesupport (>= 3.0.0)
43
- i18n (1.1.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.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.3.0)
49
+ mini_portile2 (2.4.0)
50
50
  minitest (5.11.3)
51
- nokogiri (1.8.5)
52
- mini_portile2 (~> 2.3.0)
53
- parser (2.5.1.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.5)
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.0)
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.16.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> <namespaced controller>
106
+ $ rails g rspec:endpoint <action name>
107
107
 
108
108
  Example:
109
109
 
110
- $ rails g rspec:endpoint show api/v1/users
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 users
5
+ rails generate rspec:endpoint users/create
6
6
 
7
7
  This will create:
8
- create_spec.rb in spec/requests/users directory
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 "#{controller}##{file_name}").first || raise("#{controller}##{file_name} not found in routes")
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 "spec/requests/#{controller}"
31
- template 'action_request_spec.rb', "spec/requests/#{controller}/#{file_name}_spec.rb"
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
- valid_headers { {} }
7
- valid_params { {} }
6
+ headers { {} }
7
+ params { {} }
8
8
  expected_response { {} }
9
9
 
10
- describe '<%= @http_verb.upcase %> <%= controller %>#<%= file_name %>' do
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 %>
@@ -1,3 +1,3 @@
1
1
  module RspecRequestHelpers
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -2,7 +2,6 @@ require 'rspec_request_helpers/version'
2
2
  require 'rspec_request_helpers/configuration'
3
3
  require 'rspec_request_helpers/helpers'
4
4
  require 'rack'
5
- require 'pry'
6
5
 
7
6
  module RspecRequestHelpers
8
7
  SYMBOL_TO_STATUS_CODE = Rack::Utils::SYMBOL_TO_STATUS_CODE
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.1
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: 2018-11-20 00:00:00.000000000 Z
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
- rubyforge_project:
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