routes2spec 0.3.0 → 0.4.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 197213dfc7438c267e64f2ad938f57d7e9a48454781e6aabeae8eebba7e6f79c
|
4
|
+
data.tar.gz: a963d77704bb92c2177ddd05b1d7fd2053b13df1c54a866597db16a300d72acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: decf81e5b7aa98f01e6d48b7590f1e6bb6773c7e61f9f65071e303b12ead8f098ab179d627b82fe8c8512a765db0e931ab7366b2eede8675484f77a4666af5c7
|
7
|
+
data.tar.gz: cdff45fff6fc5f45cf8e13336e123a0b566fb239b88577afa4991a7a96f6b7e6b1075da88e79373de687ac67e44029d9f9705dc9582568ca7864aad14285776e
|
data/lib/routes2spec/command.rb
CHANGED
@@ -17,6 +17,7 @@ module Routes2spec
|
|
17
17
|
desc: "Filter by a specific controller, e.g. PostsController or Admin::PostsController."
|
18
18
|
class_option :grep, aliases: "-g", desc: "Grep routes by a specific pattern."
|
19
19
|
class_option :symbol_status, banner: "", desc: "Use symbols for http status."
|
20
|
+
class_option :literal_path, banner: "", desc: "Use literal paths instead of path helper."
|
20
21
|
class_option :overwrite, banner: "", desc: "Prompts for confirmation to overwrite each file if it already exists."
|
21
22
|
class_option :force_overwrite, banner: "", desc: "Forcibly overwrites existing files without confirmation."
|
22
23
|
class_option :pending, banner: "", desc: "Mark examples as pending."
|
@@ -115,7 +116,7 @@ module Routes2spec
|
|
115
116
|
end
|
116
117
|
|
117
118
|
def formatter_opts
|
118
|
-
options.symbolize_keys.slice(:symbol_status, :pending, :verb)
|
119
|
+
options.symbolize_keys.slice(:symbol_status, :literal_path, :pending, :verb)
|
119
120
|
end
|
120
121
|
end
|
121
122
|
end
|
@@ -76,14 +76,19 @@ module Routes2spec
|
|
76
76
|
Routes2spec.log_debug "endpoint: #{endpoint}, constraints: #{constraints}"
|
77
77
|
# TODO: insert constraints to routing spec
|
78
78
|
status = @opts[:symbol_status] ? SYMBOL_STATUS[verb.to_sym] : STATUS[verb.to_sym]
|
79
|
+
use_literal_path = @opts[:literal_path] || false
|
80
|
+
path_helper_str = "#{path_name}_path#{params_str.empty? ? "" : "(#{params_str})"}"
|
81
|
+
literal_path_str = "\"#{path}\""
|
82
|
+
path_str = use_literal_path ? literal_path_str : path_helper_str
|
79
83
|
r.merge(
|
80
84
|
path: path,
|
85
|
+
path_str: path_str,
|
81
86
|
path_name: path_name,
|
82
87
|
params_str: params_str,
|
83
88
|
reqs: r[:reqs],
|
84
89
|
endpoint: endpoint,
|
85
90
|
constraints: constraints || "",
|
86
|
-
status: status
|
91
|
+
status: status,
|
87
92
|
)
|
88
93
|
end.compact
|
89
94
|
if routes.empty?
|
@@ -4,7 +4,7 @@ RSpec.describe "<%= controller_name %>", type: :request do
|
|
4
4
|
<% routes.each do |route| %>
|
5
5
|
describe "<%= route[:verb].upcase %> <%= route[:path] %>" do
|
6
6
|
it "works!" do
|
7
|
-
<%= pending ? 'pending "now write some real specs. and remove pending mark."' + "\n " : "" %><%= route[:verb].downcase %> <%= route[:
|
7
|
+
<%= pending ? 'pending "now write some real specs. and remove pending mark."' + "\n " : "" %><%= route[:verb].downcase %> <%= route[:path_str] %>
|
8
8
|
expect(response).to have_http_status(<%= route[:status] %>)
|
9
9
|
end
|
10
10
|
end
|
data/lib/routes2spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routes2spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shuuuuuny
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|