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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16424767a639f93e65221ccb0a759de20b7ce9fa
4
- data.tar.gz: ce5f1080da4406d14d893246af12360ada46308f
3
+ metadata.gz: cef5dd69f1ae647200ad40a7fd84b9bd758df233
4
+ data.tar.gz: 7852c75a5be3ddda15983cd75177e7d187449928
5
5
  SHA512:
6
- metadata.gz: 998a80e8e4399e80a8cb555ac596a2758c8beea6bd2f7e8fe13017b4a8931baa40efd2f892a899733dd94803418bdadde63069e21cd351e5dee9db49a2ce8adc
7
- data.tar.gz: fb113c8116c5b0e575d2b6fed6e500b83bad9d96fbace45bdbfbb1eca6f5ebf77648ba1af5e16a09327e7a6eb1dc90e9a29e4b1268e9b4cfd2c8b57fe03caaaf
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
- @class_moduels ||= []
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
- @moduleable_moduels ||= []
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
- if @modules.empty?
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 @modules.empty?
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
- controller_name, action_name = second_argument.hash_value("to").to_s.split('#')
35
- action_names = [action_name]
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module RailsBestPractices
3
- VERSION = "1.15.2"
3
+ VERSION = "1.15.3"
4
4
  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.2
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-03-11 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport