rails_best_practices 0.3.27 → 0.4.0
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.
- data/README.textile +37 -52
- data/VERSION +1 -1
- data/lib/rails_best_practices/checks.rb +0 -3
- data/lib/rails_best_practices/checks/check.rb +1 -1
- data/lib/rails_best_practices/checks/needless_deep_nesting_check.rb +36 -4
- data/lib/rails_best_practices/checks/not_use_default_route_check.rb +3 -2
- data/lib/rails_best_practices/checks/overuse_route_customizations_check.rb +23 -10
- data/lib/rails_best_practices/core/visitable_sexp.rb +2 -2
- data/rails_best_practices.gemspec +16 -25
- data/rails_best_practices.yml +0 -3
- data/spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb +55 -21
- data/spec/rails_best_practices/checks/not_use_default_route_check_spec.rb +51 -22
- data/spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb +128 -59
- metadata +17 -26
- data/lib/rails_best_practices/checks/many_to_many_collection_check.rb +0 -12
- data/lib/rails_best_practices/checks/nested_model_forms_check.rb +0 -12
- data/lib/rails_best_practices/checks/use_model_callback_check.rb +0 -12
- data/spec/rails_best_practices/checks/many_to_many_collection_check_spec.rb +0 -11
- data/spec/rails_best_practices/checks/nested_model_forms_check_spec.rb +0 -11
- data/spec/rails_best_practices/checks/use_model_callback_check_spec.rb +0 -11
data/README.textile
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
h1. rails_best_practices
|
2
2
|
|
3
|
-
rails_best_practices is a
|
4
|
-
rails_best_practices is a code static parser tool.
|
3
|
+
rails_best_practices is a code metric tool to check the quality of rails codes.
|
5
4
|
|
6
5
|
*************************************************
|
7
6
|
|
8
7
|
h2. Resources
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
Homepage: "http://rails-bestpractices.com":http://rails-bestpractices.com
|
10
|
+
Wiki: "http://github.com/flyerhzm/rails_best_practices/wiki":http://github.com/flyerhzm/rails_best_practices/wiki
|
12
11
|
|
13
12
|
*************************************************
|
14
13
|
|
15
14
|
h2. Install
|
16
15
|
|
17
16
|
<pre><code>
|
18
|
-
sudo gem install rails_best_practices
|
17
|
+
sudo gem install rails_best_practices
|
19
18
|
</code></pre>
|
20
19
|
|
21
20
|
*************************************************
|
@@ -67,11 +66,8 @@ MoveFinderToNamedScopeCheck: { }
|
|
67
66
|
UseModelAssociationCheck: { }
|
68
67
|
UseScopeAccessCheck: { }
|
69
68
|
AddModelVirtualAttributeCheck: { }
|
70
|
-
# UseModelCallbackCheck: { }
|
71
69
|
ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 2 }
|
72
70
|
MoveModelLogicIntoModelCheck: { called_count: 4 }
|
73
|
-
# ManyToManyCollectionCheck: { }
|
74
|
-
# NestedModelFormsCheck: { }
|
75
71
|
OveruseRouteCustomizationsCheck: { customize_count: 3 }
|
76
72
|
NeedlessDeepNestingCheck: { nested_count: 2 }
|
77
73
|
NotUseDefaultRouteCheck: { }
|
@@ -89,49 +85,38 @@ ReplaceInstanceVariableWithLocalVariableCheck: { }
|
|
89
85
|
|
90
86
|
*************************************************
|
91
87
|
|
92
|
-
h2.
|
93
|
-
|
94
|
-
*
|
95
|
-
##
|
96
|
-
##
|
97
|
-
##
|
98
|
-
##
|
99
|
-
##
|
100
|
-
##
|
101
|
-
|
102
|
-
|
103
|
-
##
|
104
|
-
##
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
##
|
109
|
-
##
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
##
|
114
|
-
##
|
115
|
-
|
116
|
-
|
117
|
-
##
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
##
|
122
|
-
##
|
123
|
-
|
124
|
-
* Lesson 5. Controller
|
125
|
-
## [-Use before_filter-]
|
126
|
-
## [-DRY Controller-] # not implement, use http://github.com/josevalim/inherited_resources
|
127
|
-
|
128
|
-
* Lesson 6. View
|
129
|
-
## [-Move code into controller-]
|
130
|
-
## [-Move code into model-]
|
131
|
-
## [-Move code into helper-]
|
132
|
-
## [-Replace instance variable with local variable-]
|
133
|
-
## [-Use Form Builder-] # not implement, use http://github.com/justinfrench/formtastic
|
134
|
-
## [-Organize Helper files-] # not implement, it's rails default behaviour
|
88
|
+
h2. Implementation
|
89
|
+
|
90
|
+
* Move code from Controller to Model
|
91
|
+
## Move finder to named_scope (rails2 only)
|
92
|
+
## Use model association
|
93
|
+
## Use scope access
|
94
|
+
## Add model virtual attribute
|
95
|
+
## Replace Complex Creation with Factory Method
|
96
|
+
## Move Model Logic into the Model
|
97
|
+
|
98
|
+
* RESTful Conventions
|
99
|
+
## Overuse route customizations
|
100
|
+
## Needless deep nesting
|
101
|
+
## Not use default route
|
102
|
+
|
103
|
+
* Model
|
104
|
+
## Keep Finders on Their Own Model (rails2 only)
|
105
|
+
## the Law of Demeter
|
106
|
+
## Use Observer
|
107
|
+
|
108
|
+
* Migration
|
109
|
+
## Isolating Seed Data
|
110
|
+
## Always add DB index
|
111
|
+
|
112
|
+
* Controller
|
113
|
+
## Use before_filter
|
114
|
+
|
115
|
+
* View
|
116
|
+
## Move code into controller
|
117
|
+
## Move code into model
|
118
|
+
## Move code into helper
|
119
|
+
## Replace instance variable with local variable
|
135
120
|
|
136
121
|
*************************************************
|
137
122
|
|
@@ -142,4 +127,4 @@ h2. Links
|
|
142
127
|
|
143
128
|
*************************************************
|
144
129
|
|
145
|
-
Copyright ©
|
130
|
+
Copyright © 2010 Richard Huang (flyerhzm@gmail.com), released under the MIT license
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -2,11 +2,8 @@ require 'rails_best_practices/checks/move_finder_to_named_scope_check'
|
|
2
2
|
require 'rails_best_practices/checks/use_model_association_check'
|
3
3
|
require 'rails_best_practices/checks/use_scope_access_check'
|
4
4
|
require 'rails_best_practices/checks/add_model_virtual_attribute_check'
|
5
|
-
require 'rails_best_practices/checks/use_model_callback_check'
|
6
5
|
require 'rails_best_practices/checks/replace_complex_creation_with_factory_method_check'
|
7
6
|
require 'rails_best_practices/checks/move_model_logic_into_model_check'
|
8
|
-
require 'rails_best_practices/checks/many_to_many_collection_check'
|
9
|
-
require 'rails_best_practices/checks/nested_model_forms_check'
|
10
7
|
require 'rails_best_practices/checks/overuse_route_customizations_check'
|
11
8
|
require 'rails_best_practices/checks/needless_deep_nesting_check'
|
12
9
|
require 'rails_best_practices/checks/not_use_default_route_check'
|
@@ -3,7 +3,7 @@ require 'rails_best_practices/core/error'
|
|
3
3
|
module RailsBestPractices
|
4
4
|
module Checks
|
5
5
|
class Check
|
6
|
-
NODE_TYPES = [:call, :defn, :defs, :if, :unless, :class, :lasgn, :ivar, :block]
|
6
|
+
NODE_TYPES = [:call, :defn, :defs, :if, :unless, :class, :lasgn, :ivar, :block, :iter]
|
7
7
|
|
8
8
|
CONTROLLER_FILES = /_controller\.rb$/
|
9
9
|
MIGRATION_FILES = /db\/migrate\/.*\.rb/
|
@@ -8,7 +8,7 @@ module RailsBestPractices
|
|
8
8
|
class NeedlessDeepNestingCheck < Check
|
9
9
|
|
10
10
|
def interesting_nodes
|
11
|
-
[:call]
|
11
|
+
[:call, :iter]
|
12
12
|
end
|
13
13
|
|
14
14
|
def interesting_files
|
@@ -17,11 +17,28 @@ module RailsBestPractices
|
|
17
17
|
|
18
18
|
def initialize(options = {})
|
19
19
|
super()
|
20
|
+
@counter = 0
|
20
21
|
@nested_count = options['nested_count'] || 2
|
21
22
|
end
|
22
23
|
|
23
24
|
def evaluate_start(node)
|
24
|
-
|
25
|
+
check_nested_count(node)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def check_nested_count(node)
|
30
|
+
if :iter == node.node_type
|
31
|
+
check_for_rails3(node)
|
32
|
+
elsif :resources == node.message and node.subject
|
33
|
+
check_for_rails2(node)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_for_rails3(node)
|
38
|
+
nested_count_for_rails3(node)
|
39
|
+
end
|
40
|
+
|
41
|
+
def check_for_rails2(node)
|
25
42
|
if node.subject == s(:call, nil, :map, s(:arglist))
|
26
43
|
@counter = 0
|
27
44
|
else
|
@@ -29,7 +46,22 @@ module RailsBestPractices
|
|
29
46
|
add_error "needless deep nesting (nested_count > #{@nested_count})" if @counter >= @nested_count
|
30
47
|
end
|
31
48
|
end
|
32
|
-
|
49
|
+
|
50
|
+
def nested_count_for_rails3(node)
|
51
|
+
if :iter == node.node_type and :resources == node.subject.message and !node.message
|
52
|
+
@counter += 1
|
53
|
+
nested_count_for_rails3(node[3])
|
54
|
+
@counter -= 1
|
55
|
+
elsif :block == node.node_type
|
56
|
+
node.children.each do |child_node|
|
57
|
+
if :resources == child_node.message and nil == child_node.subject and @counter + 1 > @nested_count
|
58
|
+
add_error "needless deep nesting (nested_count > #{@nested_count})", child_node.file, child_node.line
|
59
|
+
end
|
60
|
+
end
|
61
|
+
elsif :call == node.node_type and :resources == node.message
|
62
|
+
add_error "needless deep nesting (nested_count > #{@nested_count})", node.file, node.line if @counter + 1 > @nested_count
|
63
|
+
end
|
64
|
+
end
|
33
65
|
end
|
34
66
|
end
|
35
|
-
end
|
67
|
+
end
|
@@ -17,10 +17,11 @@ module RailsBestPractices
|
|
17
17
|
|
18
18
|
def evaluate_start(node)
|
19
19
|
if node == s(:call, s(:lvar, :map), :connect, s(:arglist, s(:str, ":controller/:action/:id"))) or
|
20
|
-
node == s(:call, s(:lvar, :map), :connect, s(:arglist, s(:str, ":controller/:action/:id.:format")))
|
20
|
+
node == s(:call, s(:lvar, :map), :connect, s(:arglist, s(:str, ":controller/:action/:id.:format"))) or
|
21
|
+
node == s(:call, nil, :match, s(:arglist, s(:str, ":controller(/:action(/:id(.:format)))")))
|
21
22
|
add_error "not use default route"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
|
-
end
|
27
|
+
end
|
@@ -8,7 +8,7 @@ module RailsBestPractices
|
|
8
8
|
class OveruseRouteCustomizationsCheck < Check
|
9
9
|
|
10
10
|
def interesting_nodes
|
11
|
-
[:call]
|
11
|
+
[:call, :iter]
|
12
12
|
end
|
13
13
|
|
14
14
|
def interesting_files
|
@@ -21,19 +21,32 @@ module RailsBestPractices
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def evaluate_start(node)
|
24
|
-
|
25
|
-
add_error "overuse route customizations (customize_count > #{@customize_count})" if member_and_collection_count(node) > @customize_count
|
26
|
-
end
|
24
|
+
add_error "overuse route customizations (customize_count > #{@customize_count})", node.file, node.subject.line if member_and_collection_count(node) > @customize_count
|
27
25
|
end
|
28
26
|
|
29
27
|
private
|
28
|
+
def member_and_collection_count(node)
|
29
|
+
if :resources == node.message
|
30
|
+
member_and_collection_count_for_rails2(node)
|
31
|
+
elsif :iter == node.node_type and :resources == node.subject.message
|
32
|
+
member_and_collection_count_for_rails3(node)
|
33
|
+
end
|
34
|
+
end
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
# this is the checker for rails3 style routes
|
37
|
+
def member_and_collection_count_for_rails3(node)
|
38
|
+
get_nodes = node.grep_nodes(:node_type => :call, :message => :get)
|
39
|
+
post_nodes = node.grep_nodes(:node_type => :call, :message => :post)
|
40
|
+
get_nodes.size + post_nodes.size
|
41
|
+
end
|
42
|
+
|
43
|
+
# this is the checker for rails2 style routes
|
44
|
+
def member_and_collection_count_for_rails2(node)
|
45
|
+
hash_nodes = node.grep_nodes(:node_type => :hash)
|
46
|
+
return 0 if hash_nodes.empty?
|
47
|
+
customize_hash = eval(hash_nodes.first.to_ruby)
|
48
|
+
(customize_hash[:member].size || 0) + (customize_hash[:collection].size || 0)
|
49
|
+
end
|
37
50
|
end
|
38
51
|
end
|
39
52
|
end
|
@@ -47,13 +47,13 @@ class Sexp
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def subject
|
50
|
-
if [:attrasgn, :call, :iasgn, :lasgn, :class].include? node_type
|
50
|
+
if [:attrasgn, :call, :iasgn, :lasgn, :class, :iter].include? node_type
|
51
51
|
self[1]
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
def message
|
56
|
-
if [:attrasgn, :call, :defs].include? node_type
|
56
|
+
if [:attrasgn, :call, :defs, :iter].include? node_type
|
57
57
|
self[2]
|
58
58
|
end
|
59
59
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails_best_practices}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Richard Huang"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-15}
|
13
13
|
s.default_executable = %q{rails_best_practices}
|
14
14
|
s.description = %q{a code metric tool for rails codes.}
|
15
15
|
s.email = %q{flyerhzm@gmail.com}
|
@@ -34,21 +34,18 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/rails_best_practices/checks/isolate_seed_data_check.rb",
|
35
35
|
"lib/rails_best_practices/checks/keep_finders_on_their_own_model_check.rb",
|
36
36
|
"lib/rails_best_practices/checks/law_of_demeter_check.rb",
|
37
|
-
"lib/rails_best_practices/checks/many_to_many_collection_check.rb",
|
38
37
|
"lib/rails_best_practices/checks/move_code_into_controller_check.rb",
|
39
38
|
"lib/rails_best_practices/checks/move_code_into_helper_check.rb",
|
40
39
|
"lib/rails_best_practices/checks/move_code_into_model_check.rb",
|
41
40
|
"lib/rails_best_practices/checks/move_finder_to_named_scope_check.rb",
|
42
41
|
"lib/rails_best_practices/checks/move_model_logic_into_model_check.rb",
|
43
42
|
"lib/rails_best_practices/checks/needless_deep_nesting_check.rb",
|
44
|
-
"lib/rails_best_practices/checks/nested_model_forms_check.rb",
|
45
43
|
"lib/rails_best_practices/checks/not_use_default_route_check.rb",
|
46
44
|
"lib/rails_best_practices/checks/overuse_route_customizations_check.rb",
|
47
45
|
"lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb",
|
48
46
|
"lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb",
|
49
47
|
"lib/rails_best_practices/checks/use_before_filter_check.rb",
|
50
48
|
"lib/rails_best_practices/checks/use_model_association_check.rb",
|
51
|
-
"lib/rails_best_practices/checks/use_model_callback_check.rb",
|
52
49
|
"lib/rails_best_practices/checks/use_observer_check.rb",
|
53
50
|
"lib/rails_best_practices/checks/use_scope_access_check.rb",
|
54
51
|
"lib/rails_best_practices/command.rb",
|
@@ -65,21 +62,18 @@ Gem::Specification.new do |s|
|
|
65
62
|
"spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb",
|
66
63
|
"spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb",
|
67
64
|
"spec/rails_best_practices/checks/law_of_demeter_check_spec.rb",
|
68
|
-
"spec/rails_best_practices/checks/many_to_many_collection_check_spec.rb",
|
69
65
|
"spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb",
|
70
66
|
"spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb",
|
71
67
|
"spec/rails_best_practices/checks/move_code_into_model_check_spec.rb",
|
72
68
|
"spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb",
|
73
69
|
"spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb",
|
74
70
|
"spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb",
|
75
|
-
"spec/rails_best_practices/checks/nested_model_forms_check_spec.rb",
|
76
71
|
"spec/rails_best_practices/checks/not_use_default_route_check_spec.rb",
|
77
72
|
"spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb",
|
78
73
|
"spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb",
|
79
74
|
"spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb",
|
80
75
|
"spec/rails_best_practices/checks/use_before_filter_check_spec.rb",
|
81
76
|
"spec/rails_best_practices/checks/use_model_association_check_spec.rb",
|
82
|
-
"spec/rails_best_practices/checks/use_model_callback_check_spec.rb",
|
83
77
|
"spec/rails_best_practices/checks/use_observer_check_spec.rb",
|
84
78
|
"spec/rails_best_practices/checks/use_scope_access_check_spec.rb",
|
85
79
|
"spec/spec.opts",
|
@@ -91,28 +85,25 @@ Gem::Specification.new do |s|
|
|
91
85
|
s.rubygems_version = %q{1.3.6}
|
92
86
|
s.summary = %q{a code metric tool for rails codes.}
|
93
87
|
s.test_files = [
|
94
|
-
"spec/rails_best_practices/checks/
|
95
|
-
"spec/rails_best_practices/checks/always_add_db_index_check_spec.rb",
|
96
|
-
"spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb",
|
97
|
-
"spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb",
|
98
|
-
"spec/rails_best_practices/checks/law_of_demeter_check_spec.rb",
|
99
|
-
"spec/rails_best_practices/checks/many_to_many_collection_check_spec.rb",
|
100
|
-
"spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb",
|
101
|
-
"spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb",
|
102
|
-
"spec/rails_best_practices/checks/move_code_into_model_check_spec.rb",
|
103
|
-
"spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb",
|
88
|
+
"spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb",
|
104
89
|
"spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb",
|
105
|
-
"spec/rails_best_practices/checks/
|
106
|
-
"spec/rails_best_practices/checks/
|
107
|
-
"spec/rails_best_practices/checks/
|
90
|
+
"spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb",
|
91
|
+
"spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb",
|
92
|
+
"spec/rails_best_practices/checks/use_observer_check_spec.rb",
|
108
93
|
"spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb",
|
94
|
+
"spec/rails_best_practices/checks/always_add_db_index_check_spec.rb",
|
95
|
+
"spec/rails_best_practices/checks/use_before_filter_check_spec.rb",
|
96
|
+
"spec/rails_best_practices/checks/law_of_demeter_check_spec.rb",
|
97
|
+
"spec/rails_best_practices/checks/use_scope_access_check_spec.rb",
|
109
98
|
"spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb",
|
99
|
+
"spec/rails_best_practices/checks/not_use_default_route_check_spec.rb",
|
100
|
+
"spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb",
|
101
|
+
"spec/rails_best_practices/checks/add_model_virtual_attribute_check_spec.rb",
|
110
102
|
"spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb",
|
111
|
-
"spec/rails_best_practices/checks/use_before_filter_check_spec.rb",
|
112
103
|
"spec/rails_best_practices/checks/use_model_association_check_spec.rb",
|
113
|
-
"spec/rails_best_practices/checks/
|
114
|
-
"spec/rails_best_practices/checks/
|
115
|
-
"spec/rails_best_practices/checks/
|
104
|
+
"spec/rails_best_practices/checks/move_code_into_model_check_spec.rb",
|
105
|
+
"spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb",
|
106
|
+
"spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb",
|
116
107
|
"spec/spec_helper.rb"
|
117
108
|
]
|
118
109
|
|
data/rails_best_practices.yml
CHANGED
@@ -2,11 +2,8 @@ MoveFinderToNamedScopeCheck: { }
|
|
2
2
|
UseModelAssociationCheck: { }
|
3
3
|
UseScopeAccessCheck: { }
|
4
4
|
AddModelVirtualAttributeCheck: { }
|
5
|
-
# UseModelCallbackCheck: { }
|
6
5
|
ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 2 }
|
7
6
|
MoveModelLogicIntoModelCheck: { called_count: 4 }
|
8
|
-
# ManyToManyCollectionCheck: { }
|
9
|
-
# NestedModelFormsCheck: { }
|
10
7
|
OveruseRouteCustomizationsCheck: { customize_count: 3 }
|
11
8
|
NeedlessDeepNestingCheck: { nested_count: 2 }
|
12
9
|
NotUseDefaultRouteCheck: { }
|
@@ -5,32 +5,66 @@ describe RailsBestPractices::Checks::NeedlessDeepNestingCheck do
|
|
5
5
|
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::NeedlessDeepNestingCheck.new)
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
describe "rails2" do
|
9
|
+
it "should needless deep nesting" do
|
10
|
+
content = <<-EOF
|
11
|
+
map.resources :posts do |post|
|
12
|
+
post.resources :comments do |comment|
|
13
|
+
comment.resources :favorites
|
14
|
+
end
|
15
|
+
end
|
16
|
+
EOF
|
17
|
+
@runner.check('config/routes.rb', content)
|
18
|
+
errors = @runner.errors
|
19
|
+
errors.should_not be_empty
|
20
|
+
errors[0].to_s.should == "config/routes.rb:3 - needless deep nesting (nested_count > 2)"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should no needless deep nesting" do
|
24
|
+
content = <<-EOF
|
25
|
+
map.resources :posts do |post|
|
26
|
+
post.resources :comments
|
27
|
+
end
|
28
|
+
|
29
|
+
map.resources :comments do |comment|
|
12
30
|
comment.resources :favorites
|
13
31
|
end
|
32
|
+
EOF
|
33
|
+
@runner.check('config/routes.rb', content)
|
34
|
+
errors = @runner.errors
|
35
|
+
errors.should be_empty
|
14
36
|
end
|
15
|
-
EOF
|
16
|
-
@runner.check('config/routes.rb', content)
|
17
|
-
errors = @runner.errors
|
18
|
-
errors.should_not be_empty
|
19
|
-
errors[0].to_s.should == "config/routes.rb:3 - needless deep nesting (nested_count > 2)"
|
20
37
|
end
|
21
38
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
describe "rails3" do
|
40
|
+
it "should needless deep nesting" do
|
41
|
+
content = <<-EOF
|
42
|
+
resources :posts do
|
43
|
+
resources :comments do
|
44
|
+
resources :favorites
|
45
|
+
end
|
46
|
+
end
|
47
|
+
EOF
|
48
|
+
@runner.check('config/routes.rb', content)
|
49
|
+
errors = @runner.errors
|
50
|
+
errors.should_not be_empty
|
51
|
+
errors[0].to_s.should == "config/routes.rb:4 - needless deep nesting (nested_count > 2)"
|
26
52
|
end
|
27
|
-
|
28
|
-
|
29
|
-
|
53
|
+
|
54
|
+
it "should no needless deep nesting" do
|
55
|
+
content = <<-EOF
|
56
|
+
resources :posts do
|
57
|
+
resources :comments
|
58
|
+
resources :votes
|
59
|
+
end
|
60
|
+
|
61
|
+
resources :comments do
|
62
|
+
resources :favorites
|
63
|
+
end
|
64
|
+
EOF
|
65
|
+
@runner.check('config/routes.rb', content)
|
66
|
+
errors = @runner.errors
|
67
|
+
errors.should be_empty
|
30
68
|
end
|
31
|
-
EOF
|
32
|
-
@runner.check('config/routes.rb', content)
|
33
|
-
errors = @runner.errors
|
34
|
-
errors.should be_empty
|
35
69
|
end
|
36
|
-
end
|
70
|
+
end
|
@@ -5,30 +5,59 @@ describe RailsBestPractices::Checks::NotUseDefaultRouteCheck do
|
|
5
5
|
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::NotUseDefaultRouteCheck.new)
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
describe "rails2" do
|
9
|
+
it "should not use default route" do
|
10
|
+
content = <<-EOF
|
11
|
+
ActionController::Routing::Routes.draw do |map|
|
12
|
+
map.resources :posts, :member => { :push => :post }
|
13
|
+
|
14
|
+
map.connect ':controller/:action/:id'
|
15
|
+
map.connect ':controller/:action/:id.:format'
|
16
|
+
end
|
17
|
+
EOF
|
18
|
+
@runner.check('config/routes.rb', content)
|
19
|
+
errors = @runner.errors
|
20
|
+
errors.should_not be_empty
|
21
|
+
errors[0].to_s.should == "config/routes.rb:4 - not use default route"
|
22
|
+
errors[1].to_s.should == "config/routes.rb:5 - not use default route"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should no not use default route" do
|
26
|
+
content = <<-EOF
|
27
|
+
ActionController::Routing::Routes.draw do |map|
|
28
|
+
map.resources :posts, :member => { :push => :post }
|
29
|
+
end
|
30
|
+
EOF
|
31
|
+
@runner.check('config/routes.rb', content)
|
32
|
+
errors = @runner.errors
|
33
|
+
errors.should be_empty
|
15
34
|
end
|
16
|
-
EOF
|
17
|
-
@runner.check('config/routes.rb', content)
|
18
|
-
errors = @runner.errors
|
19
|
-
errors.should_not be_empty
|
20
|
-
errors[0].to_s.should == "config/routes.rb:4 - not use default route"
|
21
|
-
errors[1].to_s.should == "config/routes.rb:5 - not use default route"
|
22
35
|
end
|
23
36
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
describe "rails3" do
|
38
|
+
it "should not use default route" do
|
39
|
+
content = <<-EOF
|
40
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
41
|
+
resources :posts
|
42
|
+
|
43
|
+
match ':controller(/:action(/:id(.:format)))'
|
44
|
+
end
|
45
|
+
EOF
|
46
|
+
@runner.check('config/routes.rb', content)
|
47
|
+
errors = @runner.errors
|
48
|
+
errors.should_not be_empty
|
49
|
+
errors[0].to_s.should == "config/routes.rb:5 - not use default route"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should no not use default route" do
|
53
|
+
content = <<-EOF
|
54
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
55
|
+
resources :posts
|
56
|
+
end
|
57
|
+
EOF
|
58
|
+
@runner.check('config/routes.rb', content)
|
59
|
+
errors = @runner.errors
|
60
|
+
errors.should be_empty
|
28
61
|
end
|
29
|
-
EOF
|
30
|
-
@runner.check('config/routes.rb', content)
|
31
|
-
errors = @runner.errors
|
32
|
-
errors.should be_empty
|
33
62
|
end
|
34
|
-
end
|
63
|
+
end
|
@@ -4,73 +4,142 @@ describe RailsBestPractices::Checks::OveruseRouteCustomizationsCheck do
|
|
4
4
|
before(:each) do
|
5
5
|
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::OveruseRouteCustomizationsCheck.new)
|
6
6
|
end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
|
8
|
+
describe "rails2" do
|
9
|
+
it "should overuse route customizations" do
|
10
|
+
content = <<-EOF
|
11
|
+
ActionController::Routing::Routes.draw do |map|
|
12
|
+
map.resources :posts, :member => { :comments => :get,
|
13
|
+
:create_comment => :post,
|
14
|
+
:update_comment => :post,
|
15
|
+
:delete_comment => :post }
|
16
|
+
end
|
17
|
+
EOF
|
18
|
+
@runner.check('config/routes.rb', content)
|
19
|
+
errors = @runner.errors
|
20
|
+
errors.should_not be_empty
|
21
|
+
errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
|
15
22
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
|
24
|
+
it "should overuse route customizations with collection" do
|
25
|
+
content = <<-EOF
|
26
|
+
ActionController::Routing::Routes.draw do |map|
|
27
|
+
map.resources :posts, :member => { :create_comment => :post,
|
28
|
+
:update_comment => :post,
|
29
|
+
:delete_comment => :post },
|
30
|
+
:collection => { :comments => :get }
|
31
|
+
end
|
32
|
+
EOF
|
33
|
+
@runner.check('config/routes.rb', content)
|
34
|
+
errors = @runner.errors
|
35
|
+
errors.should_not be_empty
|
36
|
+
errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
|
30
37
|
end
|
31
|
-
EOF
|
32
|
-
@runner.check('config/routes.rb', content)
|
33
|
-
errors = @runner.errors
|
34
|
-
errors.should_not be_empty
|
35
|
-
errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
|
36
|
-
end
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
39
|
+
it "should overuse route customizations with collection 2" do
|
40
|
+
content = <<-EOF
|
41
|
+
ActionController::Routing::Routes.draw do |map|
|
42
|
+
map.resources :categories do |category|
|
43
|
+
category.resources :posts, :member => { :create_comment => :post,
|
44
|
+
:update_comment => :post,
|
45
|
+
:delete_comment => :post },
|
46
|
+
:collection => { :comments => :get }
|
47
|
+
end
|
46
48
|
end
|
49
|
+
EOF
|
50
|
+
@runner.check('config/routes.rb', content)
|
51
|
+
errors = @runner.errors
|
52
|
+
errors.should_not be_empty
|
53
|
+
errors[0].to_s.should == "config/routes.rb:3 - overuse route customizations (customize_count > 3)"
|
47
54
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
|
56
|
+
it "should not overuse route customizations without customization" do
|
57
|
+
content = <<-EOF
|
58
|
+
ActionController::Routing::Routes.draw do |map|
|
59
|
+
map.resources :posts
|
60
|
+
end
|
61
|
+
EOF
|
62
|
+
@runner.check('config/routes.rb', content)
|
63
|
+
errors = @runner.errors
|
64
|
+
errors.should be_empty
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should not overuse route customizations when customize route is only one" do
|
68
|
+
content = <<-EOF
|
69
|
+
ActionController::Routing::Routes.draw do |map|
|
70
|
+
map.resources :posts, :member => { :vote => :post }
|
71
|
+
end
|
72
|
+
EOF
|
73
|
+
@runner.check('config/routes.rb', content)
|
74
|
+
errors = @runner.errors
|
75
|
+
errors.should be_empty
|
59
76
|
end
|
60
|
-
EOF
|
61
|
-
@runner.check('config/routes.rb', content)
|
62
|
-
errors = @runner.errors
|
63
|
-
errors.should be_empty
|
64
77
|
end
|
65
78
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
79
|
+
describe "rails3" do
|
80
|
+
it "should overuse route customizations" do
|
81
|
+
content = <<-EOF
|
82
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
83
|
+
resources :posts do
|
84
|
+
member do
|
85
|
+
post :create_comment
|
86
|
+
post :update_comment
|
87
|
+
post :delete_comment
|
88
|
+
end
|
89
|
+
|
90
|
+
collection do
|
91
|
+
get :comments
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
EOF
|
96
|
+
@runner.check('config/routes.rb', content)
|
97
|
+
errors = @runner.errors
|
98
|
+
errors.should_not be_empty
|
99
|
+
errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should overuse route customizations another way" do
|
103
|
+
content = <<-EOF
|
104
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
105
|
+
resources :posts do
|
106
|
+
post :create_comment, :on => :member
|
107
|
+
post :update_comment, :on => :member
|
108
|
+
post :delete_comment, :on => :member
|
109
|
+
get :comments, :on => :collection
|
110
|
+
end
|
111
|
+
end
|
112
|
+
EOF
|
113
|
+
@runner.check('config/routes.rb', content)
|
114
|
+
errors = @runner.errors
|
115
|
+
errors.should_not be_empty
|
116
|
+
errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should not overuse route customizations without customization" do
|
120
|
+
content = <<-EOF
|
121
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
122
|
+
resources :posts
|
123
|
+
end
|
124
|
+
EOF
|
125
|
+
@runner.check('config/routes.rb', content)
|
126
|
+
errors = @runner.errors
|
127
|
+
errors.should be_empty
|
128
|
+
end
|
129
|
+
|
130
|
+
it "should not overuse route customizations when customize route is only one" do
|
131
|
+
content = <<-EOF
|
132
|
+
RailsBestpracticesCom::Application.routes.draw do |map|
|
133
|
+
resources :posts do
|
134
|
+
member do
|
135
|
+
post :vote
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
EOF
|
140
|
+
@runner.check('config/routes.rb', content)
|
141
|
+
errors = @runner.errors
|
142
|
+
errors.should be_empty
|
70
143
|
end
|
71
|
-
EOF
|
72
|
-
@runner.check('config/routes.rb', content)
|
73
|
-
errors = @runner.errors
|
74
|
-
errors.should be_empty
|
75
144
|
end
|
76
145
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 4
|
8
|
+
- 0
|
9
|
+
version: 0.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Richard Huang
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-15 00:00:00 +08:00
|
18
18
|
default_executable: rails_best_practices
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -70,21 +70,18 @@ files:
|
|
70
70
|
- lib/rails_best_practices/checks/isolate_seed_data_check.rb
|
71
71
|
- lib/rails_best_practices/checks/keep_finders_on_their_own_model_check.rb
|
72
72
|
- lib/rails_best_practices/checks/law_of_demeter_check.rb
|
73
|
-
- lib/rails_best_practices/checks/many_to_many_collection_check.rb
|
74
73
|
- lib/rails_best_practices/checks/move_code_into_controller_check.rb
|
75
74
|
- lib/rails_best_practices/checks/move_code_into_helper_check.rb
|
76
75
|
- lib/rails_best_practices/checks/move_code_into_model_check.rb
|
77
76
|
- lib/rails_best_practices/checks/move_finder_to_named_scope_check.rb
|
78
77
|
- lib/rails_best_practices/checks/move_model_logic_into_model_check.rb
|
79
78
|
- lib/rails_best_practices/checks/needless_deep_nesting_check.rb
|
80
|
-
- lib/rails_best_practices/checks/nested_model_forms_check.rb
|
81
79
|
- lib/rails_best_practices/checks/not_use_default_route_check.rb
|
82
80
|
- lib/rails_best_practices/checks/overuse_route_customizations_check.rb
|
83
81
|
- lib/rails_best_practices/checks/replace_complex_creation_with_factory_method_check.rb
|
84
82
|
- lib/rails_best_practices/checks/replace_instance_variable_with_local_variable_check.rb
|
85
83
|
- lib/rails_best_practices/checks/use_before_filter_check.rb
|
86
84
|
- lib/rails_best_practices/checks/use_model_association_check.rb
|
87
|
-
- lib/rails_best_practices/checks/use_model_callback_check.rb
|
88
85
|
- lib/rails_best_practices/checks/use_observer_check.rb
|
89
86
|
- lib/rails_best_practices/checks/use_scope_access_check.rb
|
90
87
|
- lib/rails_best_practices/command.rb
|
@@ -101,21 +98,18 @@ files:
|
|
101
98
|
- spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb
|
102
99
|
- spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb
|
103
100
|
- spec/rails_best_practices/checks/law_of_demeter_check_spec.rb
|
104
|
-
- spec/rails_best_practices/checks/many_to_many_collection_check_spec.rb
|
105
101
|
- spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb
|
106
102
|
- spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb
|
107
103
|
- spec/rails_best_practices/checks/move_code_into_model_check_spec.rb
|
108
104
|
- spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb
|
109
105
|
- spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb
|
110
106
|
- spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb
|
111
|
-
- spec/rails_best_practices/checks/nested_model_forms_check_spec.rb
|
112
107
|
- spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
|
113
108
|
- spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
|
114
109
|
- spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
|
115
110
|
- spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
|
116
111
|
- spec/rails_best_practices/checks/use_before_filter_check_spec.rb
|
117
112
|
- spec/rails_best_practices/checks/use_model_association_check_spec.rb
|
118
|
-
- spec/rails_best_practices/checks/use_model_callback_check_spec.rb
|
119
113
|
- spec/rails_best_practices/checks/use_observer_check_spec.rb
|
120
114
|
- spec/rails_best_practices/checks/use_scope_access_check_spec.rb
|
121
115
|
- spec/spec.opts
|
@@ -151,26 +145,23 @@ signing_key:
|
|
151
145
|
specification_version: 3
|
152
146
|
summary: a code metric tool for rails codes.
|
153
147
|
test_files:
|
154
|
-
- spec/rails_best_practices/checks/add_model_virtual_attribute_check_spec.rb
|
155
|
-
- spec/rails_best_practices/checks/always_add_db_index_check_spec.rb
|
156
148
|
- spec/rails_best_practices/checks/isolate_seed_data_check_spec.rb
|
157
|
-
- spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb
|
158
|
-
- spec/rails_best_practices/checks/law_of_demeter_check_spec.rb
|
159
|
-
- spec/rails_best_practices/checks/many_to_many_collection_check_spec.rb
|
160
|
-
- spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb
|
161
|
-
- spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb
|
162
|
-
- spec/rails_best_practices/checks/move_code_into_model_check_spec.rb
|
163
|
-
- spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb
|
164
149
|
- spec/rails_best_practices/checks/move_model_logic_into_model_check_spec.rb
|
165
|
-
- spec/rails_best_practices/checks/
|
166
|
-
- spec/rails_best_practices/checks/
|
167
|
-
- spec/rails_best_practices/checks/
|
150
|
+
- spec/rails_best_practices/checks/move_code_into_helper_check_spec.rb
|
151
|
+
- spec/rails_best_practices/checks/move_code_into_controller_check_spec.rb
|
152
|
+
- spec/rails_best_practices/checks/use_observer_check_spec.rb
|
168
153
|
- spec/rails_best_practices/checks/overuse_route_customizations_check_spec.rb
|
154
|
+
- spec/rails_best_practices/checks/always_add_db_index_check_spec.rb
|
155
|
+
- spec/rails_best_practices/checks/use_before_filter_check_spec.rb
|
156
|
+
- spec/rails_best_practices/checks/law_of_demeter_check_spec.rb
|
157
|
+
- spec/rails_best_practices/checks/use_scope_access_check_spec.rb
|
169
158
|
- spec/rails_best_practices/checks/replace_complex_creation_with_factory_method_check_spec.rb
|
159
|
+
- spec/rails_best_practices/checks/not_use_default_route_check_spec.rb
|
160
|
+
- spec/rails_best_practices/checks/move_finder_to_named_scope_check_spec.rb
|
161
|
+
- spec/rails_best_practices/checks/add_model_virtual_attribute_check_spec.rb
|
170
162
|
- spec/rails_best_practices/checks/replace_instance_variable_with_local_variable_check_spec.rb
|
171
|
-
- spec/rails_best_practices/checks/use_before_filter_check_spec.rb
|
172
163
|
- spec/rails_best_practices/checks/use_model_association_check_spec.rb
|
173
|
-
- spec/rails_best_practices/checks/
|
174
|
-
- spec/rails_best_practices/checks/
|
175
|
-
- spec/rails_best_practices/checks/
|
164
|
+
- spec/rails_best_practices/checks/move_code_into_model_check_spec.rb
|
165
|
+
- spec/rails_best_practices/checks/needless_deep_nesting_check_spec.rb
|
166
|
+
- spec/rails_best_practices/checks/keep_finders_on_their_own_model_check_spec.rb
|
176
167
|
- spec/spec_helper.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe RailsBestPractices::Checks::ManyToManyCollectionCheck do
|
4
|
-
before(:each) do
|
5
|
-
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::ManyToManyCollectionCheck.new)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should many to many collection check" do
|
9
|
-
pending
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe RailsBestPractices::Checks::NestedModelFormsCheck do
|
4
|
-
before(:each) do
|
5
|
-
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::NestedModelFormsCheck.new)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should nested model form check" do
|
9
|
-
pending
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__) + '/../../spec_helper')
|
2
|
-
|
3
|
-
describe RailsBestPractices::Checks::UseModelCallbackCheck do
|
4
|
-
before(:each) do
|
5
|
-
@runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::UseModelCallbackCheck.new)
|
6
|
-
end
|
7
|
-
|
8
|
-
it "should use model callback check" do
|
9
|
-
pending
|
10
|
-
end
|
11
|
-
end
|