Permalink
Browse files

Deprecated should_require_acceptance_of in favor of should_validate_a…

…cceptance_of
  • Loading branch information...
1 parent 5da9cb1 commit f12d1abfaa7f86e353db1b0a4d43928a85cf9fb8 @jferris jferris committed Jan 30, 2009
Showing with 10 additions and 2 deletions.
  1. +9 −2 lib/shoulda/active_record/macros.rb
  2. +1 −0 test/unit/user_test.rb
@@ -503,9 +503,9 @@ def should_have_indices(*columns)
# Regexp or string. Default = <tt>I18n.translate('activerecord.errors.messages.accepted')</tt>
#
# Example:
- # should_require_acceptance_of :eula
+ # should_validate_acceptance_of :eula
#
- def should_require_acceptance_of(*attributes)
+ def should_validate_acceptance_of(*attributes)
message = get_options!(attributes, :message)
klass = model_class
@@ -517,6 +517,13 @@ def should_require_acceptance_of(*attributes)
end
end
+ # Deprecated. See should_validate_uniqueness_of
+ def should_require_acceptance_of(*attributes)
+ warn "[DEPRECATION] should_require_acceptance_of is deprecated. " <<
+ "Use should_validate_acceptance_of instead."
+ should_validate_acceptance_of(*attributes)
+ end
+
# Ensures that the model has a method named scope_name that returns a NamedScope object with the
# proxy options set to the options you supply. scope_name can be either a symbol, or a method
# call which will be evaled against the model. The eval'd method call has access to all the same
View
@@ -46,6 +46,7 @@ class UserTest < Test::Unit::TestCase
should_have_db_column :id, :type => "integer"
should_have_db_column :email, :type => "string", :default => nil, :precision => nil, :limit => 255,
:null => true, :scale => nil
+ should_validate_acceptance_of :eula
should_require_acceptance_of :eula
should_validate_uniqueness_of :email, :scoped_to => :name, :case_sensitive => false

0 comments on commit f12d1ab

Please sign in to comment.