rails_best_practices 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/.travis.yml +4 -1
  2. data/Gemfile +0 -3
  3. data/Gemfile.lock +10 -9
  4. data/README.md +2 -0
  5. data/lib/rails_best_practices/analyzer.rb +40 -21
  6. data/lib/rails_best_practices/core.rb +1 -0
  7. data/lib/rails_best_practices/core/check.rb +12 -0
  8. data/lib/rails_best_practices/core/configs.rb +7 -0
  9. data/lib/rails_best_practices/core/error.rb +2 -1
  10. data/lib/rails_best_practices/core/routes.rb +11 -5
  11. data/lib/rails_best_practices/core/runner.rb +6 -2
  12. data/lib/rails_best_practices/core_ext/sexp.rb +3 -1
  13. data/lib/rails_best_practices/prepares.rb +5 -0
  14. data/lib/rails_best_practices/prepares/config_prepare.rb +21 -0
  15. data/lib/rails_best_practices/prepares/route_prepare.rb +24 -7
  16. data/lib/rails_best_practices/reviews/protect_mass_assignment_review.rb +11 -3
  17. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +7 -3
  18. data/lib/rails_best_practices/version.rb +1 -1
  19. data/rails_best_practices.gemspec +1 -0
  20. data/spec/rails_best_practices/analyzer_spec.rb +52 -32
  21. data/spec/rails_best_practices/core/check_spec.rb +64 -45
  22. data/spec/rails_best_practices/core/checking_visitor_spec.rb +65 -64
  23. data/spec/rails_best_practices/core/configs_spec.rb +7 -0
  24. data/spec/rails_best_practices/core/controllers_spec.rb +4 -2
  25. data/spec/rails_best_practices/core/error_spec.rb +28 -22
  26. data/spec/rails_best_practices/core/helpers_spec.rb +4 -2
  27. data/spec/rails_best_practices/core/klasses_spec.rb +8 -6
  28. data/spec/rails_best_practices/core/mailers_spec.rb +4 -2
  29. data/spec/rails_best_practices/core/methods_spec.rb +37 -35
  30. data/spec/rails_best_practices/core/model_associations_spec.rb +17 -15
  31. data/spec/rails_best_practices/core/model_attributes_spec.rb +17 -15
  32. data/spec/rails_best_practices/core/models_spec.rb +4 -2
  33. data/spec/rails_best_practices/core/modules_spec.rb +21 -19
  34. data/spec/rails_best_practices/core/nil_spec.rb +23 -21
  35. data/spec/rails_best_practices/core/routes_spec.rb +21 -14
  36. data/spec/rails_best_practices/core/runner_spec.rb +17 -15
  37. data/spec/rails_best_practices/core_ext/sexp_spec.rb +32 -7
  38. data/spec/rails_best_practices/lexicals/remove_tab_check_spec.rb +35 -31
  39. data/spec/rails_best_practices/lexicals/remove_trailing_whitespace_check_spec.rb +35 -31
  40. data/spec/rails_best_practices/prepares/config_prepare_spec.rb +24 -0
  41. data/spec/rails_best_practices/prepares/controller_prepare_spec.rb +122 -123
  42. data/spec/rails_best_practices/prepares/helper_prepare_spec.rb +36 -32
  43. data/spec/rails_best_practices/prepares/mailer_prepare_spec.rb +12 -8
  44. data/spec/rails_best_practices/prepares/model_prepare_spec.rb +326 -322
  45. data/spec/rails_best_practices/prepares/route_prepare_spec.rb +619 -573
  46. data/spec/rails_best_practices/prepares/schema_prepare_spec.rb +25 -21
  47. data/spec/rails_best_practices/reviews/add_model_virtual_attribute_review_spec.rb +85 -87
  48. data/spec/rails_best_practices/reviews/always_add_db_index_review_spec.rb +224 -222
  49. data/spec/rails_best_practices/reviews/dry_bundler_in_capistrano_review_spec.rb +30 -26
  50. data/spec/rails_best_practices/reviews/isolate_seed_data_review_spec.rb +79 -75
  51. data/spec/rails_best_practices/reviews/keep_finders_on_their_own_model_review_spec.rb +76 -72
  52. data/spec/rails_best_practices/reviews/law_of_demeter_review_spec.rb +138 -140
  53. data/spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb +38 -34
  54. data/spec/rails_best_practices/reviews/move_code_into_helper_review_spec.rb +22 -18
  55. data/spec/rails_best_practices/reviews/move_code_into_model_review_spec.rb +57 -53
  56. data/spec/rails_best_practices/reviews/move_finder_to_named_scope_review_spec.rb +62 -63
  57. data/spec/rails_best_practices/reviews/move_model_logic_into_model_review_spec.rb +51 -50
  58. data/spec/rails_best_practices/reviews/needless_deep_nesting_review_spec.rb +140 -136
  59. data/spec/rails_best_practices/reviews/not_use_default_route_review_spec.rb +48 -44
  60. data/spec/rails_best_practices/reviews/not_use_times_ago_in_words_review_spec.rb +42 -38
  61. data/spec/rails_best_practices/reviews/overuse_route_customizations_review_spec.rb +151 -149
  62. data/spec/rails_best_practices/reviews/protect_mass_assignment_review_spec.rb +86 -55
  63. data/spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb +23 -19
  64. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +290 -286
  65. data/spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb +76 -72
  66. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +601 -597
  67. data/spec/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review_spec.rb +55 -54
  68. data/spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb +34 -30
  69. data/spec/rails_best_practices/reviews/restrict_auto_generated_routes_review_spec.rb +288 -289
  70. data/spec/rails_best_practices/reviews/simplify_render_in_controllers_review_spec.rb +59 -55
  71. data/spec/rails_best_practices/reviews/simplify_render_in_views_review_spec.rb +73 -69
  72. data/spec/rails_best_practices/reviews/use_before_filter_review_spec.rb +89 -98
  73. data/spec/rails_best_practices/reviews/use_model_association_review_spec.rb +52 -52
  74. data/spec/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review_spec.rb +192 -190
  75. data/spec/rails_best_practices/reviews/use_observer_review_spec.rb +114 -121
  76. data/spec/rails_best_practices/reviews/use_query_attribute_review_spec.rb +189 -190
  77. data/spec/rails_best_practices/reviews/use_say_with_time_in_migrations_review_spec.rb +97 -93
  78. data/spec/rails_best_practices/reviews/use_scope_access_review_spec.rb +146 -151
  79. data/spec/spec_helper.rb +11 -20
  80. metadata +42 -26
  81. data/.watchr.example +0 -65
@@ -1,177 +1,179 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsBestPractices::Reviews::OveruseRouteCustomizationsReview do
4
- let(:runner) { RailsBestPractices::Core::Runner.new(
5
- :reviews => RailsBestPractices::Reviews::OveruseRouteCustomizationsReview.new
6
- ) }
3
+ module RailsBestPractices
4
+ module Reviews
5
+ describe OveruseRouteCustomizationsReview do
6
+ let(:runner) { Core::Runner.new(:reviews => OveruseRouteCustomizationsReview.new) }
7
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 => :update,
15
- :delete_comment => :delete }
16
- end
17
- EOF
18
- runner.review('config/routes.rb', content)
19
- runner.should have(1).errors
20
- runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
21
- end
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 => :update,
15
+ :delete_comment => :delete }
16
+ end
17
+ EOF
18
+ runner.review('config/routes.rb', content)
19
+ runner.should have(1).errors
20
+ runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
21
+ end
22
22
 
23
- it "should overuse route customizations with member" do
24
- content = <<-EOF
25
- ActionController::Routing::Routes.draw do |map|
26
- map.resources :posts, :member => { :create_comment => :post,
27
- :update_comment => :update,
28
- :delete_comment => :delete,
29
- :disable_comment => :post }
30
- end
31
- EOF
32
- runner.review('config/routes.rb', content)
33
- runner.should have(1).errors
34
- runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
35
- end
23
+ it "should overuse route customizations with member" do
24
+ content = <<-EOF
25
+ ActionController::Routing::Routes.draw do |map|
26
+ map.resources :posts, :member => { :create_comment => :post,
27
+ :update_comment => :update,
28
+ :delete_comment => :delete,
29
+ :disable_comment => :post }
30
+ end
31
+ EOF
32
+ runner.review('config/routes.rb', content)
33
+ runner.should have(1).errors
34
+ runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
35
+ end
36
36
 
37
- it "should overuse route customizations with collection" do
38
- content = <<-EOF
39
- ActionController::Routing::Routes.draw do |map|
40
- map.resources :posts, :collection => { :list_comments => :get,
41
- :update_comments => :get,
42
- :delete_comments => :get,
43
- :disable_comments => :get }
44
- end
45
- EOF
46
- runner.review('config/routes.rb', content)
47
- runner.should have(1).errors
48
- runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
49
- end
37
+ it "should overuse route customizations with collection" do
38
+ content = <<-EOF
39
+ ActionController::Routing::Routes.draw do |map|
40
+ map.resources :posts, :collection => { :list_comments => :get,
41
+ :update_comments => :get,
42
+ :delete_comments => :get,
43
+ :disable_comments => :get }
44
+ end
45
+ EOF
46
+ runner.review('config/routes.rb', content)
47
+ runner.should have(1).errors
48
+ runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
49
+ end
50
50
 
51
- it "should overuse route customizations with hash member and collection" do
52
- content = <<-EOF
53
- ActionController::Routing::Routes.draw do |map|
54
- map.resources :categories do |category|
55
- category.resources :posts, :member => { :create_comment => :post,
56
- :update_comment => :update,
57
- :delete_comment => :delete },
58
- :collection => { :comments => :get }
51
+ it "should overuse route customizations with hash member and collection" do
52
+ content = <<-EOF
53
+ ActionController::Routing::Routes.draw do |map|
54
+ map.resources :categories do |category|
55
+ category.resources :posts, :member => { :create_comment => :post,
56
+ :update_comment => :update,
57
+ :delete_comment => :delete },
58
+ :collection => { :comments => :get }
59
+ end
60
+ end
61
+ EOF
62
+ runner.review('config/routes.rb', content)
63
+ runner.should have(1).errors
64
+ runner.errors[0].to_s.should == "config/routes.rb:3 - overuse route customizations (customize_count > 3)"
59
65
  end
60
- end
61
- EOF
62
- runner.review('config/routes.rb', content)
63
- runner.should have(1).errors
64
- runner.errors[0].to_s.should == "config/routes.rb:3 - overuse route customizations (customize_count > 3)"
65
- end
66
66
 
67
- it "should overuse route customizations with array member and collection" do
68
- content = <<-EOF
69
- ActionController::Routing::Routes.draw do |map|
70
- map.resources :categories do |category|
71
- category.resources :posts, :member => [:create_comment, :update_comment, :delete_comment],
72
- :collection => [:comments]
67
+ it "should overuse route customizations with array member and collection" do
68
+ content = <<-EOF
69
+ ActionController::Routing::Routes.draw do |map|
70
+ map.resources :categories do |category|
71
+ category.resources :posts, :member => [:create_comment, :update_comment, :delete_comment],
72
+ :collection => [:comments]
73
+ end
74
+ end
75
+ EOF
76
+ runner.review('config/routes.rb', content)
77
+ runner.should have(1).errors
78
+ runner.errors[0].to_s.should == "config/routes.rb:3 - overuse route customizations (customize_count > 3)"
73
79
  end
74
- end
75
- EOF
76
- runner.review('config/routes.rb', content)
77
- runner.should have(1).errors
78
- runner.errors[0].to_s.should == "config/routes.rb:3 - overuse route customizations (customize_count > 3)"
79
- end
80
80
 
81
- it "should not overuse route customizations without customization" do
82
- content = <<-EOF
83
- ActionController::Routing::Routes.draw do |map|
84
- map.resources :posts
85
- end
86
- EOF
87
- runner.review('config/routes.rb', content)
88
- runner.should have(0).errors
89
- end
81
+ it "should not overuse route customizations without customization" do
82
+ content = <<-EOF
83
+ ActionController::Routing::Routes.draw do |map|
84
+ map.resources :posts
85
+ end
86
+ EOF
87
+ runner.review('config/routes.rb', content)
88
+ runner.should have(0).errors
89
+ end
90
90
 
91
- it "should not overuse route customizations when customize route is only one" do
92
- content = <<-EOF
93
- ActionController::Routing::Routes.draw do |map|
94
- map.resources :posts, :member => { :vote => :post }
95
- end
96
- EOF
97
- runner.review('config/routes.rb', content)
98
- runner.should have(0).errors
99
- end
91
+ it "should not overuse route customizations when customize route is only one" do
92
+ content = <<-EOF
93
+ ActionController::Routing::Routes.draw do |map|
94
+ map.resources :posts, :member => { :vote => :post }
95
+ end
96
+ EOF
97
+ runner.review('config/routes.rb', content)
98
+ runner.should have(0).errors
99
+ end
100
100
 
101
- it "should not raise error for constants in routes" do
102
- content =<<-EOF
103
- IP_PATTERN = /(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}))|[\d]+/.freeze
104
- map.resources :vlans do |vlan|
105
- vlan.resources :ip_ranges, :member => {:move => [:get, :post]} do |range|
106
- range.resources :ips, :requirements => { :id => IP_PATTERN }
101
+ it "should not raise error for constants in routes" do
102
+ content =<<-EOF
103
+ IP_PATTERN = /(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2}))|[\d]+/.freeze
104
+ map.resources :vlans do |vlan|
105
+ vlan.resources :ip_ranges, :member => {:move => [:get, :post]} do |range|
106
+ range.resources :ips, :requirements => { :id => IP_PATTERN }
107
+ end
108
+ end
109
+ EOF
110
+ runner.review('config/routes.rb', content)
111
+ runner.should have(0).errors
107
112
  end
108
113
  end
109
- EOF
110
- runner.review('config/routes.rb', content)
111
- runner.should have(0).errors
112
- end
113
- end
114
114
 
115
- describe "rails3" do
116
- it "should overuse route customizations" do
117
- content = <<-EOF
118
- RailsBestpracticesCom::Application.routes.draw do
119
- resources :posts do
120
- member do
121
- post :create_comment
122
- update :update_comment
123
- delete :delete_comment
124
- end
115
+ describe "rails3" do
116
+ it "should overuse route customizations" do
117
+ content = <<-EOF
118
+ RailsBestpracticesCom::Application.routes.draw do
119
+ resources :posts do
120
+ member do
121
+ post :create_comment
122
+ update :update_comment
123
+ delete :delete_comment
124
+ end
125
125
 
126
- collection do
127
- get :comments
126
+ collection do
127
+ get :comments
128
+ end
129
+ end
128
130
  end
131
+ EOF
132
+ runner.review('config/routes.rb', content)
133
+ runner.should have(1).errors
134
+ runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
129
135
  end
130
- end
131
- EOF
132
- runner.review('config/routes.rb', content)
133
- runner.should have(1).errors
134
- runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
135
- end
136
136
 
137
- it "should overuse route customizations another way" do
138
- content = <<-EOF
139
- RailsBestpracticesCom::Application.routes.draw do
140
- resources :posts do
141
- post :create_comment, :on => :member
142
- update :update_comment, :on => :member
143
- delete :delete_comment, :on => :member
144
- get :comments, :on => :collection
137
+ it "should overuse route customizations another way" do
138
+ content = <<-EOF
139
+ RailsBestpracticesCom::Application.routes.draw do
140
+ resources :posts do
141
+ post :create_comment, :on => :member
142
+ update :update_comment, :on => :member
143
+ delete :delete_comment, :on => :member
144
+ get :comments, :on => :collection
145
+ end
146
+ end
147
+ EOF
148
+ runner.review('config/routes.rb', content)
149
+ runner.should have(1).errors
150
+ runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
145
151
  end
146
- end
147
- EOF
148
- runner.review('config/routes.rb', content)
149
- runner.should have(1).errors
150
- runner.errors[0].to_s.should == "config/routes.rb:2 - overuse route customizations (customize_count > 3)"
151
- end
152
152
 
153
- it "should not overuse route customizations without customization" do
154
- content = <<-EOF
155
- RailsBestpracticesCom::Application.routes.draw do
156
- resources :posts
157
- end
158
- EOF
159
- runner.review('config/routes.rb', content)
160
- runner.should have(0).errors
161
- end
153
+ it "should not overuse route customizations without customization" do
154
+ content = <<-EOF
155
+ RailsBestpracticesCom::Application.routes.draw do
156
+ resources :posts
157
+ end
158
+ EOF
159
+ runner.review('config/routes.rb', content)
160
+ runner.should have(0).errors
161
+ end
162
162
 
163
- it "should not overuse route customizations when customize route is only one" do
164
- content = <<-EOF
165
- RailsBestpracticesCom::Application.routes.draw do
166
- resources :posts do
167
- member do
168
- post :vote
163
+ it "should not overuse route customizations when customize route is only one" do
164
+ content = <<-EOF
165
+ RailsBestpracticesCom::Application.routes.draw do
166
+ resources :posts do
167
+ member do
168
+ post :vote
169
+ end
170
+ end
169
171
  end
172
+ EOF
173
+ runner.review('config/routes.rb', content)
174
+ runner.should have(0).errors
170
175
  end
171
176
  end
172
- EOF
173
- runner.review('config/routes.rb', content)
174
- runner.should have(0).errors
175
177
  end
176
178
  end
177
179
  end
@@ -1,67 +1,98 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RailsBestPractices::Reviews::ProtectMassAssignmentReview do
4
- let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::ProtectMassAssignmentReview.new) }
3
+ module RailsBestPractices
4
+ module Reviews
5
+ describe ProtectMassAssignmentReview do
6
+ let(:runner) { Core::Runner.new(:reviews => ProtectMassAssignmentReview.new) }
5
7
 
6
- it "should protect mass assignment" do
7
- content =<<-EOF
8
- class User < ActiveRecord::Base
9
- end
10
- EOF
11
- runner.review('app/models/user.rb', content)
12
- runner.should have(1).errors
13
- runner.errors[0].to_s.should == "app/models/user.rb:1 - protect mass assignment"
14
- end
8
+ it "should protect mass assignment" do
9
+ content =<<-EOF
10
+ class User < ActiveRecord::Base
11
+ end
12
+ EOF
13
+ runner.review('app/models/user.rb', content)
14
+ runner.should have(1).errors
15
+ runner.errors[0].to_s.should == "app/models/user.rb:1 - protect mass assignment"
16
+ end
15
17
 
16
- it "should not protect mass assignment with attr_accessible" do
17
- content =<<-EOF
18
- class User < ActiveRecord::Base
19
- attr_accessible :email, :password, :password_confirmation
20
- end
21
- EOF
22
- runner.review('app/models/user.rb', content)
23
- runner.should have(0).errors
24
- end
18
+ it "should not protect mass assignment if attr_accessible is used with arguments" do
19
+ content =<<-EOF
20
+ class User < ActiveRecord::Base
21
+ attr_accessible :email, :password, :password_confirmation
22
+ end
23
+ EOF
24
+ runner.review('app/models/user.rb', content)
25
+ runner.should have(0).errors
26
+ end
25
27
 
26
- it "should not protect mass assignment with attr_protected" do
27
- content =<<-EOF
28
- class User < ActiveRecord::Base
29
- attr_protected :role
30
- end
31
- EOF
32
- runner.review('app/models/user.rb', content)
33
- runner.should have(0).errors
34
- end
28
+ it "should not protect mass assignment if attr_accessible is used without arguments" do
29
+ content =<<-EOF
30
+ class User < ActiveRecord::Base
31
+ attr_accessible
32
+ end
33
+ EOF
34
+ runner.review('app/models/user.rb', content)
35
+ runner.should have(0).errors
36
+ end
35
37
 
36
- it "should not protect mass assignment if using devise" do
37
- content =<<-EOF
38
- class User < ActiveRecord::Base
39
- devise :database_authenticatable, :registerable, :confirmable, :recoverable, :stretches => 20
40
- end
41
- EOF
42
- runner.review('app/models/user.rb', content)
43
- runner.should have(0).errors
44
- end
38
+ it "should not protect mass assignment with attr_protected" do
39
+ content =<<-EOF
40
+ class User < ActiveRecord::Base
41
+ attr_protected :role
42
+ end
43
+ EOF
44
+ runner.review('app/models/user.rb', content)
45
+ runner.should have(0).errors
46
+ end
45
47
 
46
- it "should not protect mass assignment if using authlogic with configuration" do
47
- content =<<-EOF
48
- class User < ActiveRecord::Base
49
- acts_as_authentic do |c|
50
- c.my_config_option = my_value
48
+ it "should not protect mass assignment if using devise" do
49
+ content =<<-EOF
50
+ class User < ActiveRecord::Base
51
+ devise :database_authenticatable, :registerable, :confirmable, :recoverable, :stretches => 20
52
+ end
53
+ EOF
54
+ runner.review('app/models/user.rb', content)
55
+ runner.should have(0).errors
51
56
  end
52
- end
53
- EOF
54
- runner.review('app/models/user.rb', content)
55
- runner.should have(0).errors
56
- end
57
57
 
58
- it "should not protect mass assignment if using authlogic without configuration" do
59
- content =<<-EOF
60
- class User < ActiveRecord::Base
61
- acts_as_authentic
58
+ it "should not protect mass assignment if using authlogic with configuration" do
59
+ content =<<-EOF
60
+ class User < ActiveRecord::Base
61
+ acts_as_authentic do |c|
62
+ c.my_config_option = my_value
63
+ end
64
+ end
65
+ EOF
66
+ runner.review('app/models/user.rb', content)
67
+ runner.should have(0).errors
68
+ end
69
+
70
+ it "should not protect mass assignment if using authlogic without configuration" do
71
+ content =<<-EOF
72
+ class User < ActiveRecord::Base
73
+ acts_as_authentic
74
+ end
75
+ EOF
76
+ runner.review('app/models/user.rb', content)
77
+ runner.should have(0).errors
78
+ end
79
+
80
+ it "should not protect mass assignment if user set config.active_record.whitelist_attributes" do
81
+ content =<<-EOF
82
+ module RailsBestPracticesCom
83
+ class Application < Rails::Application
84
+ config.active_record.whitelist_attributes = true
85
+ end
86
+ end
87
+ EOF
88
+ runner.prepare('config/application.rb', content)
89
+ content =<<-EOF
90
+ class User < ActiveRecord::Base
91
+ end
92
+ EOF
93
+ runner.review('app/models/user.rb', content)
94
+ runner.should have(0).errors
95
+ end
62
96
  end
63
- EOF
64
- runner.review('app/models/user.rb', content)
65
- runner.should have(0).errors
66
97
  end
67
98
  end