rails_best_practices 1.5.3 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Gemfile.lock +1 -1
  2. data/README.md +11 -7
  3. data/assets/result.html.erb +6 -4
  4. data/lib/rails_best_practices/analyzer.rb +45 -42
  5. data/lib/rails_best_practices/command.rb +36 -9
  6. data/lib/rails_best_practices/core.rb +2 -0
  7. data/lib/rails_best_practices/core/check.rb +52 -18
  8. data/lib/rails_best_practices/core/error.rb +8 -0
  9. data/lib/rails_best_practices/core/helpers.rb +8 -0
  10. data/lib/rails_best_practices/core/modules.rb +39 -0
  11. data/lib/rails_best_practices/core/runner.rb +14 -3
  12. data/lib/rails_best_practices/prepares.rb +9 -0
  13. data/lib/rails_best_practices/prepares/controller_prepare.rb +15 -3
  14. data/lib/rails_best_practices/prepares/helper_prepare.rb +41 -0
  15. data/lib/rails_best_practices/prepares/mailer_prepare.rb +1 -1
  16. data/lib/rails_best_practices/prepares/model_prepare.rb +1 -1
  17. data/lib/rails_best_practices/reviews.rb +1 -0
  18. data/lib/rails_best_practices/reviews/always_add_db_index_review.rb +2 -2
  19. data/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb +13 -3
  20. data/lib/rails_best_practices/reviews/remove_unused_methods_in_helpers_review.rb +47 -0
  21. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +3 -3
  22. data/lib/rails_best_practices/version.rb +1 -1
  23. data/rails_best_practices.yml +1 -0
  24. data/spec/rails_best_practices/analyzer_spec.rb +3 -3
  25. data/spec/rails_best_practices/core/error_spec.rb +10 -1
  26. data/spec/rails_best_practices/core/helpers_spec.rb +5 -0
  27. data/spec/rails_best_practices/core/modules_spec.rb +26 -0
  28. data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +32 -1
  29. data/spec/rails_best_practices/prepares/helper_prepare_spec.rb +41 -0
  30. data/spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb +11 -11
  31. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +15 -15
  32. data/spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb +84 -0
  33. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +31 -31
  34. metadata +35 -23
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe RailsBestPractices::Prepares::HelperPrepare do
4
+ let(:runner) { RailsBestPractices::Core::Runner.new(:parepare => RailsBestPractices::Prepares::HelperPrepare.new) }
5
+
6
+ context "methods" do
7
+ it "should parse helper methods" do
8
+ content =<<-EOF
9
+ module PostsHelper
10
+ def used; end
11
+ def unused; end
12
+ end
13
+ EOF
14
+ runner.prepare('app/helpers/posts_helper.rb', content)
15
+ methods = RailsBestPractices::Prepares.helper_methods
16
+ methods.get_methods("PostsHelper").map(&:method_name).should == ["used", "unused"]
17
+ end
18
+
19
+ it "should parse helpers" do
20
+ content =<<-EOF
21
+ module PostsHelper
22
+ end
23
+ EOF
24
+ runner.prepare('app/helpers/posts_helper.rb', content)
25
+ content =<<-EOF
26
+ module Admin::UsersHelper
27
+ end
28
+ EOF
29
+ runner.prepare('app/helpers/users_helper.rb', content)
30
+ content =<<-EOF
31
+ module Admin
32
+ module BaseHelper
33
+ end
34
+ end
35
+ EOF
36
+ runner.prepare("app/helpers/base_helper.rb", content)
37
+ helpers = RailsBestPractices::Prepares.helpers
38
+ helpers.map(&:to_s).should == ["PostsHelper", "Admin::UsersHelper", "Admin", "Admin::BaseHelper"]
39
+ end
40
+ end
41
+ end
@@ -16,7 +16,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
16
16
  end
17
17
  EOF
18
18
  runner.review('db/schema.rb', content)
19
- runner.on_complete
19
+ runner.after_review
20
20
  runner.should have(2).errors
21
21
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (comments => [post_id])"
22
22
  runner.errors[1].to_s.should == "db/schema.rb:2 - always add db index (comments => [user_id])"
@@ -33,7 +33,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
33
33
  end
34
34
  EOF
35
35
  runner.review('db/schema.rb', content)
36
- runner.on_complete
36
+ runner.after_review
37
37
  runner.should have(1).errors
38
38
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (versions => [versioned_id, versioned_type])"
39
39
  end
@@ -49,7 +49,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
49
49
  end
50
50
  EOF
51
51
  runner.review('db/schema.rb', content)
52
- runner.on_complete
52
+ runner.after_review
53
53
  runner.should have(1).errors
54
54
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (versions => [versioned_id, versioned_type])"
55
55
  end
@@ -67,7 +67,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
67
67
  end
68
68
  EOF
69
69
  runner.review('db/schema.rb', content)
70
- runner.on_complete
70
+ runner.after_review
71
71
  runner.should have(1).errors
72
72
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (taggings => [taggable_id, taggable_type])"
73
73
  end
@@ -85,7 +85,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
85
85
  end
86
86
  EOF
87
87
  runner.review('db/schema.rb', content)
88
- runner.on_complete
88
+ runner.after_review
89
89
  runner.should have(1).errors
90
90
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (taggings => [tag_id])"
91
91
  end
@@ -102,7 +102,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
102
102
  end
103
103
  EOF
104
104
  runner.review('db/schema.rb', content)
105
- runner.on_complete
105
+ runner.after_review
106
106
  runner.should have(1).errors
107
107
  runner.errors[0].to_s.should == "db/schema.rb:2 - always add db index (websites => [user_id])"
108
108
  end
@@ -117,7 +117,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
117
117
  end
118
118
  EOF
119
119
  runner.review('db/schema.rb', content)
120
- runner.on_complete
120
+ runner.after_review
121
121
  runner.should have(0).errors
122
122
  end
123
123
 
@@ -135,7 +135,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
135
135
  end
136
136
  EOF
137
137
  runner.review('db/schema.rb', content)
138
- runner.on_complete
138
+ runner.after_review
139
139
  runner.should have(0).errors
140
140
  end
141
141
 
@@ -148,7 +148,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
148
148
  end
149
149
  EOF
150
150
  runner.review('db/schema.rb', content)
151
- runner.on_complete
151
+ runner.after_review
152
152
  runner.should have(0).errors
153
153
  end
154
154
 
@@ -165,7 +165,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
165
165
  end
166
166
  EOF
167
167
  runner.review('db/schema.rb', content)
168
- runner.on_complete
168
+ runner.after_review
169
169
  runner.should have(0).errors
170
170
  end
171
171
 
@@ -182,7 +182,7 @@ describe RailsBestPractices::Reviews::AlwaysAddDbIndexReview do
182
182
  end
183
183
  EOF
184
184
  runner.review('db/schema.rb', content)
185
- runner.on_complete
185
+ runner.after_review
186
186
  runner.should have(0).errors
187
187
  end
188
188
  end
@@ -25,7 +25,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
25
25
  EOF
26
26
  runner.prepare('app/controllers/posts_controller.rb', content)
27
27
  runner.review('app/controllers/posts_controller.rb', content)
28
- runner.on_complete
28
+ runner.after_review
29
29
  runner.should have(2).errors
30
30
  runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:4 - remove unused methods (PostsController#load_post)"
31
31
  runner.errors[1].to_s.should == "app/controllers/posts_controller.rb:6 - remove unused methods (PostsController#load_user)"
@@ -49,7 +49,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
49
49
  EOF
50
50
  runner.prepare('app/controllers/posts_controller.rb', content)
51
51
  runner.review('app/controllers/posts_controller.rb', content)
52
- runner.on_complete
52
+ runner.after_review
53
53
  runner.should have(0).errors
54
54
  end
55
55
 
@@ -74,7 +74,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
74
74
  EOF
75
75
  runner.prepare('app/controllers/posts_controller.rb', content)
76
76
  runner.review('app/controllers/posts_controller.rb', content)
77
- runner.on_complete
77
+ runner.after_review
78
78
  runner.should have(0).errors
79
79
  end
80
80
 
@@ -96,7 +96,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
96
96
  EOF
97
97
  runner.prepare('app/controllers/posts_controller.rb', content)
98
98
  runner.review('app/controllers/posts_controller.rb', content)
99
- runner.on_complete
99
+ runner.after_review
100
100
  runner.should have(0).errors
101
101
  end
102
102
  end
@@ -117,7 +117,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
117
117
  EOF
118
118
  runner.prepare('app/controllers/posts_controller.rb', content)
119
119
  runner.review('app/controllers/posts_controller.rb', content)
120
- runner.on_complete
120
+ runner.after_review
121
121
  runner.should have(1).errors
122
122
  runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:3 - remove unused methods (PostsController#list)"
123
123
  end
@@ -138,7 +138,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
138
138
  EOF
139
139
  runner.prepare('app/controllers/internal_controller.rb', content)
140
140
  runner.review('app/controllers/internal_controller.rb', content)
141
- runner.on_complete
141
+ runner.after_review
142
142
  runner.should have(0).errors
143
143
  end
144
144
 
@@ -150,7 +150,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
150
150
  EOF
151
151
  runner.prepare('app/controllers/exceptable_controller.rb', content)
152
152
  runner.review('app/controllers/exceptable_controller.rb', content)
153
- runner.on_complete
153
+ runner.after_review
154
154
  runner.should have(0).errors
155
155
  end
156
156
  end
@@ -166,7 +166,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
166
166
  EOF
167
167
  runner.prepare('app/controllers/posts_controller.rb', content)
168
168
  runner.review('app/controllers/posts_controller.rb', content)
169
- runner.on_complete
169
+ runner.after_review
170
170
  runner.should have(1).errors
171
171
  runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:4 - remove unused methods (PostsController#helper_post)"
172
172
  end
@@ -185,7 +185,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
185
185
  <%= helper_post %>
186
186
  EOF
187
187
  runner.review('app/views/posts/show.html.erb', content)
188
- runner.on_complete
188
+ runner.after_review
189
189
  runner.should have(0).errors
190
190
  end
191
191
 
@@ -207,7 +207,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
207
207
  end
208
208
  EOF
209
209
  runner.review('app/helpers/posts_helper.rb', content)
210
- runner.on_complete
210
+ runner.after_review
211
211
  runner.should have(0).errors
212
212
  end
213
213
  end
@@ -228,7 +228,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
228
228
  end
229
229
  EOF
230
230
  runner.review('app/helpers/posts_helper.rb', content)
231
- runner.on_complete
231
+ runner.after_review
232
232
  runner.should have(1).errors
233
233
  runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:3 - remove unused methods (PostsController#helper_post)"
234
234
  end
@@ -252,7 +252,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
252
252
  <%= helper_post("new") %>
253
253
  EOF
254
254
  runner.review('app/views/posts/show.html.erb', content)
255
- runner.on_complete
255
+ runner.after_review
256
256
  runner.should have(0).errors
257
257
  end
258
258
  end
@@ -266,7 +266,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
266
266
  EOF
267
267
  runner.prepare('app/cells/posts_cell.rb', content)
268
268
  runner.review('app/cells/posts_cell.rb', content)
269
- runner.on_complete
269
+ runner.after_review
270
270
  runner.should have(1).errors
271
271
  runner.errors[0].to_s.should == "app/cells/posts_cell.rb:2 - remove unused methods (PostsCell#list)"
272
272
  end
@@ -285,7 +285,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
285
285
  <%= render_cell(:posts, :display) %>
286
286
  EOF
287
287
  runner.review('app/views/posts/index.html.erb', content)
288
- runner.on_complete
288
+ runner.after_review
289
289
  runner.should have(0).errors
290
290
  end
291
291
 
@@ -307,7 +307,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview do
307
307
  <%= render_cell :posts, :list %>
308
308
  EOF
309
309
  runner.review('app/views/posts/index.html.erb', content)
310
- runner.on_complete
310
+ runner.after_review
311
311
  runner.should have(0).errors
312
312
  end
313
313
  end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInHelpersReview do
4
+ let(:runner) { RailsBestPractices::Core::Runner.new(
5
+ :prepares => [RailsBestPractices::Prepares::ControllerPrepare.new, RailsBestPractices::Prepares::HelperPrepare.new],
6
+ :reviews => RailsBestPractices::Reviews::RemoveUnusedMethodsInHelpersReview.new(:except_methods => [])
7
+ ) }
8
+
9
+ it "should remove unused methods" do
10
+ content =<<-EOF
11
+ module PostsHelper
12
+ def unused; end
13
+ end
14
+ EOF
15
+ runner.prepare('app/helpers/posts_helper.rb', content)
16
+ runner.review('app/helpers/posts_helper.rb', content)
17
+ runner.after_review
18
+ runner.should have(1).errors
19
+ runner.errors[0].to_s.should == "app/helpers/posts_helper.rb:2 - remove unused methods (PostsHelper#unused)"
20
+ end
21
+
22
+ it "should not remove unused methods if called on views" do
23
+ content =<<-EOF
24
+ module PostsHelper
25
+ def used?(post); end
26
+ end
27
+ EOF
28
+ runner.prepare('app/helpers/posts_helper.rb', content)
29
+ runner.review('app/helpers/posts_helper.rb', content)
30
+ content =<<-EOF
31
+ <% if used?(@post) %>
32
+ <% end %>
33
+ EOF
34
+ runner.review('app/views/posts/show.html.erb', content)
35
+ runner.after_review
36
+ runner.should have(0).errors
37
+ end
38
+
39
+ it "should not remove unused methods if called on helpers" do
40
+ content =<<-EOF
41
+ module PostsHelper
42
+ def used?(post)
43
+ test?(post)
44
+ end
45
+
46
+ def test?(post); end
47
+ end
48
+ EOF
49
+ runner.prepare('app/helpers/posts_helper.rb', content)
50
+ runner.review('app/helpers/posts_helper.rb', content)
51
+ content =<<-EOF
52
+ <% if used?(@post) %>
53
+ <% end %>
54
+ EOF
55
+ runner.review('app/views/posts/show.html.erb', content)
56
+ runner.after_review
57
+ runner.should have(0).errors
58
+ end
59
+
60
+ it "should not remove unused methods if called on controllers" do
61
+ helper_content =<<-EOF
62
+ module PostsHelper
63
+ def used?(post); end
64
+ end
65
+ EOF
66
+ controller_content =<<-EOF
67
+ class PostsController < InheritedResources::Base
68
+ include PostsHelper
69
+
70
+ def show
71
+ @post = Post.find(params[:id])
72
+ used?(@post)
73
+ end
74
+ end
75
+ EOF
76
+ runner.prepare('app/helpers/posts_helper.rb', helper_content)
77
+ runner.prepare('app/controllers/posts_controller.rb', controller_content)
78
+ runner.after_prepare
79
+ runner.review('app/helpers/posts_helper.rb', helper_content)
80
+ runner.review('app/controllers/posts_controller.rb', controller_content)
81
+ runner.after_review
82
+ runner.should have(0).errors
83
+ end
84
+ end
@@ -25,7 +25,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
25
25
  end
26
26
  EOF
27
27
  runner.review('app/controllers/posts_controller.rb', content)
28
- runner.on_complete
28
+ runner.after_review
29
29
  runner.should have(1).errors
30
30
  runner.errors[0].to_s.should == "app/models/post.rb:4 - remove unused methods (Post#find_by_sql)"
31
31
  end
@@ -38,7 +38,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
38
38
  EOF
39
39
  runner.prepare('app/models/post.rb', content)
40
40
  runner.review('app/models/post.rb', content)
41
- runner.on_complete
41
+ runner.after_review
42
42
  runner.should have(0).errors
43
43
  end
44
44
 
@@ -62,7 +62,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
62
62
  end
63
63
  EOF
64
64
  runner.review('app/controllers/posts_controller.rb', content)
65
- runner.on_complete
65
+ runner.after_review
66
66
  runner.should have(0).errors
67
67
  end
68
68
 
@@ -76,7 +76,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
76
76
  EOF
77
77
  runner.prepare('app/models/post.rb', content)
78
78
  runner.review('app/models/post.rb', content)
79
- runner.on_complete
79
+ runner.after_review
80
80
  runner.should have(0).errors
81
81
  end
82
82
 
@@ -100,7 +100,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
100
100
  end
101
101
  EOF
102
102
  runner.review('app/controllers/posts_controller.rb', content)
103
- runner.on_complete
103
+ runner.after_review
104
104
  runner.should have(0).errors
105
105
  end
106
106
 
@@ -124,7 +124,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
124
124
  end
125
125
  EOF
126
126
  runner.review('app/controllers/posts_controller.rb', content)
127
- runner.on_complete
127
+ runner.after_review
128
128
  runner.should have(0).errors
129
129
  end
130
130
 
@@ -150,7 +150,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
150
150
  end
151
151
  EOF
152
152
  runner.review('app/controllers/posts_controller.rb', content)
153
- runner.on_complete
153
+ runner.after_review
154
154
  runner.should have(0).errors
155
155
  end
156
156
 
@@ -164,7 +164,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
164
164
  EOF
165
165
  runner.prepare('app/models/post.rb', content)
166
166
  runner.review('app/models/post.rb', content)
167
- runner.on_complete
167
+ runner.after_review
168
168
  runner.should have(0).errors
169
169
  end
170
170
 
@@ -178,7 +178,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
178
178
  EOF
179
179
  runner.prepare('app/models/post.rb', content)
180
180
  runner.review('app/models/post.rb', content)
181
- runner.on_complete
181
+ runner.after_review
182
182
  runner.should have(0).errors
183
183
  end
184
184
 
@@ -191,7 +191,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
191
191
  EOF
192
192
  runner.prepare('app/models/post.rb', content)
193
193
  runner.review('app/models/post.rb', content)
194
- runner.on_complete
194
+ runner.after_review
195
195
  runner.should have(0).errors
196
196
  end
197
197
  end
@@ -204,7 +204,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
204
204
  end
205
205
  EOF
206
206
  runner.prepare('app/models/post.rb', content)
207
- runner.on_complete
207
+ runner.after_review
208
208
  runner.should have(1).errors
209
209
  runner.errors[0].to_s.should == "app/models/post.rb:2 - remove unused methods (Post#fetch)"
210
210
  end
@@ -224,7 +224,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
224
224
  end
225
225
  EOF
226
226
  runner.review('app/controllers/posts_controller.rb', content)
227
- runner.on_complete
227
+ runner.after_review
228
228
  runner.should have(0).errors
229
229
  end
230
230
 
@@ -236,7 +236,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
236
236
  EOF
237
237
  runner.prepare('app/models/post.rb', content)
238
238
  runner.review('app/models/post.rb', content)
239
- runner.on_complete
239
+ runner.after_review
240
240
  runner.should have(0).errors
241
241
  end
242
242
 
@@ -256,7 +256,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
256
256
  end
257
257
  EOF
258
258
  runner.review('app/controllers/posts_controller.rb', content)
259
- runner.on_complete
259
+ runner.after_review
260
260
  runner.should have(0).errors
261
261
  end
262
262
 
@@ -276,7 +276,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
276
276
  end
277
277
  EOF
278
278
  runner.review('app/controllers/posts_controller.rb', content)
279
- runner.on_complete
279
+ runner.after_review
280
280
  runner.should have(0).errors
281
281
  end
282
282
 
@@ -297,7 +297,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
297
297
  end
298
298
  EOF
299
299
  runner.review('app/controllers/posts_controller.rb', content)
300
- runner.on_complete
300
+ runner.after_review
301
301
  runner.should have(1).errors
302
302
  end
303
303
 
@@ -318,7 +318,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
318
318
  end
319
319
  EOF
320
320
  runner.review('app/controllers/posts_controller.rb', content)
321
- runner.on_complete
321
+ runner.after_review
322
322
  runner.should have(1).errors
323
323
  end
324
324
  end
@@ -341,7 +341,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
341
341
  end
342
342
  EOF
343
343
  runner.review('app/controllers/posts_controller.rb', content)
344
- runner.on_complete
344
+ runner.after_review
345
345
  runner.should have(1).errors
346
346
  runner.errors[0].to_s.should == "app/models/post.rb:3 - remove unused methods (Post#test)"
347
347
  end
@@ -372,7 +372,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
372
372
  end
373
373
  EOF
374
374
  runner.review('app/controllers/posts_controller.rb', content)
375
- runner.on_complete
375
+ runner.after_review
376
376
  runner.should have(0).errors
377
377
  end
378
378
  end
@@ -394,7 +394,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
394
394
  end
395
395
  EOF
396
396
  runner.review("app/controllers/posts_controller.rb", content)
397
- runner.on_complete
397
+ runner.after_review
398
398
  runner.should have(0).errors
399
399
  end
400
400
 
@@ -406,7 +406,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
406
406
  EOF
407
407
  runner.prepare("app/models/post.rb", content)
408
408
  runner.review("app/models/post.rb", content)
409
- runner.on_complete
409
+ runner.after_review
410
410
  runner.should have(1).errors
411
411
  runner.errors[0].to_s.should == "app/models/post.rb:2 - remove unused methods (Post#active)"
412
412
  end
@@ -429,7 +429,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
429
429
  end
430
430
  EOF
431
431
  runner.review("app/controllers/posts_controller.rb", content)
432
- runner.on_complete
432
+ runner.after_review
433
433
  runner.should have(0).errors
434
434
  end
435
435
 
@@ -441,7 +441,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
441
441
  EOF
442
442
  runner.prepare("app/models/post.rb", content)
443
443
  runner.review("app/models/post.rb", content)
444
- runner.on_complete
444
+ runner.after_review
445
445
  runner.should have(1).errors
446
446
  runner.errors[0].to_s.should == "app/models/post.rb:2 - remove unused methods (Post#active)"
447
447
  end
@@ -465,7 +465,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
465
465
  end
466
466
  EOF
467
467
  runner.review("app/controllers/posts_controller.rb", content)
468
- runner.on_complete
468
+ runner.after_review
469
469
  runner.should have(0).errors
470
470
  end
471
471
 
@@ -486,7 +486,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
486
486
  end
487
487
  EOF
488
488
  runner.review("app/controllers/posts_controller.rb", content)
489
- runner.on_complete
489
+ runner.after_review
490
490
  runner.should have(0).errors
491
491
  end
492
492
 
@@ -507,7 +507,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
507
507
  end
508
508
  EOF
509
509
  runner.review("app/controllers/posts_controller.rb", content)
510
- runner.on_complete
510
+ runner.after_review
511
511
  runner.should have(0).errors
512
512
  end
513
513
 
@@ -528,7 +528,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
528
528
  end
529
529
  EOF
530
530
  runner.review("app/controllers/posts_controller.rb", content)
531
- runner.on_complete
531
+ runner.after_review
532
532
  runner.should have(0).errors
533
533
  end
534
534
  end
@@ -546,7 +546,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
546
546
  EOF
547
547
  runner.prepare("app/models/post.rb", content)
548
548
  runner.review("app/models/post.rb", content)
549
- runner.on_complete
549
+ runner.after_review
550
550
  runner.should have(0).errors
551
551
  end
552
552
  end
@@ -565,7 +565,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
565
565
  EOF
566
566
  runner.prepare("app/models/post.rb", content)
567
567
  runner.review("app/models/post.rb", content)
568
- runner.on_complete
568
+ runner.after_review
569
569
  runner.should have(0).errors
570
570
  end
571
571
  end
@@ -582,7 +582,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
582
582
  EOF
583
583
  runner.prepare("app/models/post.rb", content)
584
584
  runner.review("app/models/post.rb", content)
585
- runner.on_complete
585
+ runner.after_review
586
586
  runner.should have(0).errors
587
587
  end
588
588
 
@@ -599,7 +599,7 @@ describe RailsBestPractices::Reviews::RemoveUnusedMethodsInModelsReview do
599
599
  EOF
600
600
  runner.prepare("app/models/post.rb", content)
601
601
  runner.review("app/models/post.rb", content)
602
- runner.on_complete
602
+ runner.after_review
603
603
  runner.should have(0).errors
604
604
  end
605
605
  end