francois-shoulda 2.0.5.2 → 2.0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -66,7 +66,7 @@ Quick macro tests for your ActiveRecord associations and validations:
66
66
  should_allow_values_for :email, "a@b.com", "asdf@asdf.com"
67
67
  should_ensure_length_in_range :email, 1..100
68
68
  should_ensure_value_in_range :age, 1..100
69
- should_protect_attributes :password
69
+ should_not_allow_mass_assignment_of :password
70
70
  end
71
71
 
72
72
  Makes TDD so much easier.
@@ -140,9 +140,9 @@ module ThoughtBot # :nodoc:
140
140
 
141
141
  # Ensures that the attribute cannot be set on mass update.
142
142
  #
143
- # should_protect_attributes :password, :admin_flag
143
+ # should_not_allow_mass_assignment_of :password, :admin_flag
144
144
  #
145
- def should_protect_attributes(*attributes)
145
+ def should_not_allow_mass_assignment_of(*attributes)
146
146
  get_options!(attributes)
147
147
  klass = model_class
148
148
 
@@ -161,11 +161,16 @@ module ThoughtBot # :nodoc:
161
161
  end
162
162
  end
163
163
 
164
+ def should_protect_attributes(*attributes)
165
+ warn "[DEPRECATION] should_protect_attributes is deprecated; use should_not_allow_mass_assignment_of. Please see http://thoughtbot.lighthouseapp.com/projects/5807/tickets/106-should_allow_attributes for more information."
166
+ should_not_allow_mass_assignment_of(*attributes)
167
+ end
168
+
164
169
  # Ensures that the attribute can be set on mass update.
165
170
  #
166
- # should_allow_attributes :name, :email
171
+ # should_allow_mass_assignment_of :name, :email
167
172
  #
168
- def should_allow_attributes(*attributes)
173
+ def should_allow_mass_assignment_of(*attributes)
169
174
  get_options!(attributes)
170
175
  klass = model_class
171
176
 
@@ -184,6 +189,14 @@ module ThoughtBot # :nodoc:
184
189
  end
185
190
  end
186
191
 
192
+ # <b>DEPRECATED:</b> Please see
193
+ # http://thoughtbot.lighthouseapp.com/projects/5807/tickets/106-should_allow_attributes for more
194
+ # information.
195
+ def should_allow_attributes(*attributes)
196
+ warn "[DEPRECATION] should_allow_attributes is deprecated; use should_allow_mass_assignment_of. Please see http://thoughtbot.lighthouseapp.com/projects/5807/tickets/106-should_allow_attributes for more information."
197
+ should_allow_mass_assignment_of(*attributes)
198
+ end
199
+
187
200
  # Ensures that the attribute cannot be changed once the record has been created.
188
201
  #
189
202
  # should_have_readonly_attributes :password, :admin_flag
data/test/fail_macros.rb CHANGED
@@ -9,7 +9,7 @@ module Thoughtbot
9
9
  #
10
10
  # should_fail do
11
11
  # should_require_attributes :comments
12
- # should_protect_attributes :name
12
+ # should_not_allow_mass_assignment_of :name
13
13
  # end
14
14
  def should_fail(&block)
15
15
  context "should fail when trying to run:" do
@@ -6,10 +6,10 @@ class TagTest < Test::Unit::TestCase
6
6
 
7
7
  should_ensure_length_at_least :name, 2
8
8
 
9
- should_protect_attributes :secret
9
+ should_not_allow_mass_assignment_of :secret
10
10
 
11
11
  should_fail do
12
- should_protect_attributes :name
12
+ should_not_allow_mass_assignment_of :name
13
13
  should_have_valid_fixtures
14
14
  end
15
15
  end
@@ -33,8 +33,8 @@ class UserTest < Test::Unit::TestCase
33
33
  should_allow_values_for :email, "a@b.com", "asdf@asdf.com"
34
34
  should_ensure_length_in_range :email, 1..100
35
35
  should_ensure_value_in_range :age, 1..100
36
- should_protect_attributes :password
37
- should_allow_attributes :name, :email
36
+ should_not_allow_mass_assignment_of :password
37
+ should_allow_mass_assignment_of :name, :email
38
38
  should_have_class_methods :find, :destroy
39
39
  should_have_instance_methods :email, :age, :email=, :valid?
40
40
  should_have_db_columns :name, :email, :age
@@ -50,7 +50,7 @@ class UserTest < Test::Unit::TestCase
50
50
  should_have_readonly_attributes :name
51
51
 
52
52
  should_fail do
53
- should_protect_attributes :name, :age
54
- should_allow_attributes :password
53
+ should_not_allow_mass_assignment_of :name, :age
54
+ should_allow_mass_assignment_of :password
55
55
  end
56
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: francois-shoulda
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5.2
4
+ version: 2.0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tammer Saleh