rails_best_practices 1.15.2 → 1.15.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_best_practices/core/check.rb +2 -2
- data/lib/rails_best_practices/core/klasses.rb +2 -8
- data/lib/rails_best_practices/prepares/route_prepare.rb +6 -2
- data/lib/rails_best_practices/version.rb +1 -1
- data/spec/rails_best_practices/prepares/route_prepare_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef5dd69f1ae647200ad40a7fd84b9bd758df233
|
4
|
+
data.tar.gz: 7852c75a5be3ddda15983cd75177e7d187449928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6bd653c5accb78475a08c6e56be229e35f2a8175632e423e994a07835d65952094f30cfed3d50da5d44ce7a4cf4ef755f3121bba7d1c1b0f3152b08ff8eaebb
|
7
|
+
data.tar.gz: 3ea57d56bf747f9bfbeea1709f5a9d6128a7375356321205c36185e21bc16fe96a649e7eb9c5925f923cc0c9c0934cdca535bbdc0777589ef99c11fd29469667
|
@@ -154,7 +154,7 @@ module RailsBestPractices
|
|
154
154
|
|
155
155
|
# modules.
|
156
156
|
def classable_modules
|
157
|
-
@
|
157
|
+
@class_modules ||= []
|
158
158
|
end
|
159
159
|
|
160
160
|
def klasses
|
@@ -187,7 +187,7 @@ module RailsBestPractices
|
|
187
187
|
|
188
188
|
# modules.
|
189
189
|
def moduleable_modules
|
190
|
-
@
|
190
|
+
@moduleable_modules ||= []
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -21,17 +21,11 @@ module RailsBestPractices
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def class_name
|
24
|
-
|
25
|
-
@class_name
|
26
|
-
else
|
27
|
-
@modules.map { |modu| "#{modu}::" }.join("") + @class_name
|
28
|
-
end
|
24
|
+
@modules.map { |modu| "#{modu}::" }.join("") + @class_name
|
29
25
|
end
|
30
26
|
|
31
27
|
def extend_class_name
|
32
|
-
if @
|
33
|
-
@extend_class_name
|
34
|
-
else
|
28
|
+
if @extend_class_name.present?
|
35
29
|
@modules.map { |modu| "#{modu}::" }.join("") + @extend_class_name
|
36
30
|
end
|
37
31
|
end
|
@@ -31,8 +31,12 @@ module RailsBestPractices
|
|
31
31
|
elsif :array == first_argument.sexp_type
|
32
32
|
action_names = first_argument.array_values.map(&:to_s)
|
33
33
|
elsif :bare_assoc_hash == second_argument.try(:sexp_type) && second_argument.hash_value("to").present?
|
34
|
-
|
35
|
-
|
34
|
+
if :string_literal == second_argument.hash_value("to").sexp_type
|
35
|
+
controller_name, action_name = second_argument.hash_value("to").to_s.split('#')
|
36
|
+
action_names = [action_name]
|
37
|
+
else
|
38
|
+
action_names = [second_argument.hash_value("to").to_s]
|
39
|
+
end
|
36
40
|
else
|
37
41
|
action_names = [first_argument.to_s]
|
38
42
|
end
|
@@ -713,6 +713,19 @@ module RailsBestPractices
|
|
713
713
|
expect(routes.last.to_s).to eq("PostsController#stop")
|
714
714
|
end
|
715
715
|
|
716
|
+
it "should parse custom route for resource with symbol action name" do
|
717
|
+
content =<<-EOF
|
718
|
+
RailsBestPracticesCom::Application.routes.draw do
|
719
|
+
resources :posts do
|
720
|
+
get :halt, to: :stop
|
721
|
+
end
|
722
|
+
end
|
723
|
+
EOF
|
724
|
+
runner.prepare('config/routes.rb', content)
|
725
|
+
routes = Prepares.routes
|
726
|
+
expect(routes.last.to_s).to eq("PostsController#stop")
|
727
|
+
end
|
728
|
+
|
716
729
|
it "should not take former resources for direct get/post" do
|
717
730
|
content =<<-EOF
|
718
731
|
RailsBestPracticesCom::Application.routes.draw do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_best_practices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|