<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -8,9 +8,9 @@ module ThoughtBot # :nodoc:
     #     should_require_attributes :name, :phone_number
     #     should_not_allow_values_for :phone_number, &quot;abcd&quot;, &quot;1234&quot;
     #     should_allow_values_for :phone_number, &quot;(123) 456-7890&quot;
-    #     
+    #
     #     should_protect_attributes :password
-    #     
+    #
     #     should_have_one :profile
     #     should_have_many :dogs
     #     should_have_many :messes, :through =&gt; :dogs
@@ -23,7 +23,7 @@ module ThoughtBot # :nodoc:
       # Ensures that the model cannot be saved if one of the attributes listed is not present.
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/blank/&lt;/tt&gt;
       #
       # Example:
@@ -33,14 +33,11 @@ module ThoughtBot # :nodoc:
         message = get_options!(attributes, :message)
         message ||= /blank/
         klass = model_class
-        
+
         attributes.each do |attribute|
           should &quot;require #{attribute} to be set&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, nil)
-            assert !object.valid?, &quot;#{klass.name} does not require #{attribute}.&quot;
-            assert object.errors.on(attribute), &quot;#{klass.name} does not require #{attribute}.&quot;
-            assert_contains(object.errors.on(attribute), message)
+            assert_bad_value(object, attribute, nil, message)
           end
         end
       end
@@ -49,7 +46,7 @@ module ThoughtBot # :nodoc:
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/taken/&lt;/tt&gt;
       # * &lt;tt&gt;:scoped_to&lt;/tt&gt; - field(s) to scope the uniqueness to.
       #
@@ -63,43 +60,33 @@ module ThoughtBot # :nodoc:
         message, scope = get_options!(attributes, :message, :scoped_to)
         scope = [*scope].compact
         message ||= /taken/
-        
+
         klass = model_class
         attributes.each do |attribute|
           attribute = attribute.to_sym
           should &quot;require unique value for #{attribute}#{&quot; scoped to #{scope.join(', ')}&quot; unless scope.blank?}&quot; do
             assert existing = klass.find(:first), &quot;Can't find first #{klass}&quot;
             object = klass.new
-            
-            object.send(&quot;#{attribute}=&quot;, existing.send(attribute))
+            existing_value = existing.send(attribute)
+
             if !scope.blank?
               scope.each do |s|
                 assert_respond_to object, :&quot;#{s}=&quot;, &quot;#{klass.name} doesn't seem to have a #{s} attribute.&quot;
                 object.send(&quot;#{s}=&quot;, existing.send(s))
               end
             end
-            
-            assert !object.valid?, &quot;#{klass.name} does not require a unique value for #{attribute}.&quot;
-            assert object.errors.on(attribute), &quot;#{klass.name} does not require a unique value for #{attribute}.&quot;
-            
-            assert_contains(object.errors.on(attribute), message)
-            
+            assert_bad_value(object, attribute, existing_value, message)
+
             # Now test that the object is valid when changing the scoped attribute
             # TODO:  There is a chance that we could change the scoped field
             # to a value that's already taken.  An alternative implementation
             # could actually find all values for scope and create a unique
-            # one.  
+            # one.
             if !scope.blank?
               scope.each do |s|
                 # Assume the scope is a foreign key if the field is nil
                 object.send(&quot;#{s}=&quot;, existing.send(s).nil? ? 1 : existing.send(s).next)
-              end
-
-              object.errors.clear
-              object.valid?
-              scope.each do |s|
-                assert_does_not_contain(object.errors.on(attribute), message, 
-                                        &quot;after :#{s} set to #{object.send(s.to_sym)}&quot;)
+                assert_good_value(object, attribute, existing_value, message)
               end
             end
           end
@@ -128,7 +115,7 @@ module ThoughtBot # :nodoc:
           end
         end
       end
-  
+
       # Ensures that the attribute cannot be changed once the record has been created.
       # Requires an existing record.
       #
@@ -155,7 +142,7 @@ module ThoughtBot # :nodoc:
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/invalid/&lt;/tt&gt;
       #
       # Example:
@@ -168,14 +155,11 @@ module ThoughtBot # :nodoc:
         bad_values.each do |v|
           should &quot;not allow #{attribute} to be set to #{v.inspect}&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, v)
-            assert !object.valid?, &quot;#{klass.name} allowed \&quot;#{v}\&quot; as a value for #{attribute}&quot;
-            assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{v}\&quot;&quot;
-            assert_contains(object.errors.on(attribute), message, &quot;when set to \&quot;#{v}\&quot;&quot;)
+            assert_bad_value(object, attribute, v, message)
           end
         end
       end
-  
+
       # Ensures that the attribute can be set to the given values.
       # Requires an existing record
       #
@@ -188,9 +172,7 @@ module ThoughtBot # :nodoc:
         good_values.each do |v|
           should &quot;allow #{attribute} to be set to #{v.inspect}&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, v)
-            object.valid?
-            assert_nil object.errors.on(attribute)
+            assert_good_value(object, attribute, v)
           end
         end
       end
@@ -199,9 +181,9 @@ module ThoughtBot # :nodoc:
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:short_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:short_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/short/&lt;/tt&gt;
-      # * &lt;tt&gt;:long_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:long_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/long/&lt;/tt&gt;
       #
       # Example:
@@ -211,7 +193,7 @@ module ThoughtBot # :nodoc:
         short_message, long_message = get_options!([opts], :short_message, :long_message)
         short_message ||= /short/
         long_message  ||= /long/
-        
+
         klass = model_class
         min_length = range.first
         max_length = range.last
@@ -221,11 +203,7 @@ module ThoughtBot # :nodoc:
           should &quot;not allow #{attribute} to be less than #{min_length} chars long&quot; do
             min_value = &quot;x&quot; * (min_length - 1)
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, min_value)
-            assert !object.valid?, &quot;#{klass.name} allowed \&quot;#{min_value}\&quot; as a value for #{attribute}&quot;
-            assert object.errors.on(attribute), 
-                   &quot;There are no errors set on #{attribute} after being set to \&quot;#{min_value}\&quot;&quot;
-            assert_contains(object.errors.on(attribute), short_message, &quot;when set to \&quot;#{min_value}\&quot;&quot;)
+            assert_bad_value(object, attribute, min_value, short_message)
           end
         end
 
@@ -233,38 +211,30 @@ module ThoughtBot # :nodoc:
           should &quot;allow #{attribute} to be exactly #{min_length} chars long&quot; do
             min_value = &quot;x&quot; * min_length
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, min_value)
-            object.valid?
-            assert_does_not_contain(object.errors.on(attribute), short_message, &quot;when set to \&quot;#{min_value}\&quot;&quot;)
+            assert_good_value(object, attribute, min_value, short_message)
           end
         end
-    
+
         should &quot;not allow #{attribute} to be more than #{max_length} chars long&quot; do
           max_value = &quot;x&quot; * (max_length + 1)
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, max_value)
-          assert !object.valid?, &quot;#{klass.name} allowed \&quot;#{max_value}\&quot; as a value for #{attribute}&quot;
-          assert object.errors.on(attribute), 
-                 &quot;There are no errors set on #{attribute} after being set to \&quot;#{max_value}\&quot;&quot;
-          assert_contains(object.errors.on(attribute), long_message, &quot;when set to \&quot;#{max_value}\&quot;&quot;)
+          assert_bad_value(object, attribute, max_value, long_message)
         end
 
         unless same_length
           should &quot;allow #{attribute} to be exactly #{max_length} chars long&quot; do
             max_value = &quot;x&quot; * max_length
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, max_value)
-            object.valid?
-            assert_does_not_contain(object.errors.on(attribute), long_message, &quot;when set to \&quot;#{max_value}\&quot;&quot;)
+            assert_good_value(object, attribute, max_value, long_message)
           end
         end
-      end  
-      
+      end
+
       # Ensures that the length of the attribute is at least a certain length
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:short_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:short_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/short/&lt;/tt&gt;
       #
       # Example:
@@ -273,33 +243,28 @@ module ThoughtBot # :nodoc:
       def should_ensure_length_at_least(attribute, min_length, opts = {})
         short_message = get_options!([opts], :short_message)
         short_message ||= /short/
-        
+
         klass = model_class
-        
+
         if min_length &gt; 0
           min_value = &quot;x&quot; * (min_length - 1)
           should &quot;not allow #{attribute} to be less than #{min_length} chars long&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, min_value)
-            assert !object.valid?, &quot;#{klass} allowed \&quot;#{min_value}\&quot; as a value for #{attribute}&quot;
-            assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{min_value}\&quot;&quot;
-            assert_contains(object.errors.on(attribute), short_message, &quot;when set to \&quot;#{min_value}\&quot;&quot;)
+            assert_bad_value(object, attribute, min_value, short_message)
           end
         end
         should &quot;allow #{attribute} to be at least #{min_length} chars long&quot; do
           valid_value = &quot;x&quot; * (min_length)
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, valid_value)
-          object.valid?
-          assert_does_not_contain(object.errors.on(attribute), short_message, &quot;when set to \&quot;#{valid_value}\&quot;&quot;)
+          assert_good_value(object, attribute, valid_value, short_message)
         end
       end
-      
+
       # Ensures that the length of the attribute is exactly a certain length
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/short/&lt;/tt&gt;
       #
       # Example:
@@ -314,27 +279,19 @@ module ThoughtBot # :nodoc:
         should &quot;not allow #{attribute} to be less than #{length} chars long&quot; do
           min_value = &quot;x&quot; * (length - 1)
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, min_value)
-          assert !object.valid?, &quot;#{klass} allowed \&quot;#{min_value}\&quot; as a value for #{attribute}&quot;
-          assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{min_value}\&quot;&quot;
-          assert_contains(object.errors.on(attribute), message, &quot;when set to \&quot;#{min_value}\&quot;&quot;)
+          assert_bad_value(object, attribute, min_value, message)
         end
-        
+
         should &quot;not allow #{attribute} to be greater than #{length} chars long&quot; do
           max_value = &quot;x&quot; * (length + 1)
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, max_value)
-          assert !object.valid?, &quot;#{klass} allowed \&quot;#{max_value}\&quot; as a value for #{attribute}&quot;
-          assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{max_value}\&quot;&quot;
-          assert_contains(object.errors.on(attribute), message, &quot;when set to \&quot;#{max_value}\&quot;&quot;)
+          assert_bad_value(object, attribute, max_value, message)
         end
-        
+
         should &quot;allow #{attribute} to be #{length} chars long&quot; do
           valid_value = &quot;x&quot; * (length)
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, valid_value)
-          object.valid?
-          assert_does_not_contain(object.errors.on(attribute), message, &quot;when set to \&quot;#{valid_value}\&quot;&quot;)
+          assert_good_value(object, attribute, valid_value, message)
         end
       end
 
@@ -342,9 +299,9 @@ module ThoughtBot # :nodoc:
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:low_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:low_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/included/&lt;/tt&gt;
-      # * &lt;tt&gt;:high_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:high_message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/included/&lt;/tt&gt;
       #
       # Example:
@@ -354,7 +311,7 @@ module ThoughtBot # :nodoc:
         low_message, high_message = get_options!([opts], :low_message, :high_message)
         low_message  ||= /included/
         high_message ||= /included/
-        
+
         klass = model_class
         min   = range.first
         max   = range.last
@@ -362,43 +319,33 @@ module ThoughtBot # :nodoc:
         should &quot;not allow #{attribute} to be less than #{min}&quot; do
           v = min - 1
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, v)
-          assert !object.valid?, &quot;#{klass} allowed \&quot;#{v}\&quot; as a value for #{attribute}&quot;
-          assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{v}\&quot;&quot;
-          assert_contains(object.errors.on(attribute), low_message, &quot;when set to \&quot;#{v}\&quot;&quot;)
+          assert_bad_value(object, attribute, v, low_message)
         end
 
         should &quot;allow #{attribute} to be #{min}&quot; do
           v = min
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, v)
-          object.valid?
-          assert_does_not_contain(object.errors.on(attribute), low_message, &quot;when set to \&quot;#{v}\&quot;&quot;)
+          assert_good_value(object, attribute, v, low_message)
         end
 
         should &quot;not allow #{attribute} to be more than #{max}&quot; do
           v = max + 1
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, v)
-          assert !object.valid?, &quot;#{klass} allowed \&quot;#{v}\&quot; as a value for #{attribute}&quot;
-          assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{v}\&quot;&quot;
-          assert_contains(object.errors.on(attribute), high_message, &quot;when set to \&quot;#{v}\&quot;&quot;)
+          assert_bad_value(object, attribute, v, high_message)
         end
 
         should &quot;allow #{attribute} to be #{max}&quot; do
           v = max
           object = klass.new
-          object.send(&quot;#{attribute}=&quot;, v)
-          object.valid?
-          assert_does_not_contain(object.errors.on(attribute), high_message, &quot;when set to \&quot;#{v}\&quot;&quot;)
+          assert_good_value(object, attribute, v, high_message)
         end
-      end    
-      
+      end
+
       # Ensure that the attribute is numeric
       # Requires an existing record
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/number/&lt;/tt&gt;
       #
       # Example:
@@ -412,9 +359,7 @@ module ThoughtBot # :nodoc:
           attribute = attribute.to_sym
           should &quot;only allow numeric values for #{attribute}&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, &quot;abcd&quot;)
-            assert !object.valid?, &quot;#{klass} allowed \&quot;abcd\&quot; as a value for #{attribute}&quot;
-            assert_contains(object.errors.on(attribute), message)
+            assert_bad_value(object, attribute, &quot;abcd&quot;, message)
           end
         end
       end
@@ -422,10 +367,10 @@ module ThoughtBot # :nodoc:
       # Ensures that the has_many relationship exists.  Will also test that the
       # associated table has the required columns.  Works with polymorphic
       # associations.
-      # 
+      #
       # Options:
       # * &lt;tt&gt;:through&lt;/tt&gt; - association name for &lt;tt&gt;has_many :through&lt;/tt&gt;
-      # * &lt;tt&gt;:dependent&lt;/tt&gt; - tests that the association makes use of the dependent option.      
+      # * &lt;tt&gt;:dependent&lt;/tt&gt; - tests that the association makes use of the dependent option.
       #
       # Example:
       #   should_have_many :friends
@@ -453,11 +398,11 @@ module ThoughtBot # :nodoc:
             end
 
             if dependent
-              assert_equal dependent.to_s, 
-                           reflection.options[:dependent].to_s, 
+              assert_equal dependent.to_s,
+                           reflection.options[:dependent].to_s,
                            &quot;#{associated_klass.name} should have #{dependent} dependency&quot;
             end
-            
+
             # Check for the existence of the foreign key on the other table
             unless reflection.options[:through]
               if reflection.options[:foreign_key]
@@ -467,7 +412,7 @@ module ThoughtBot # :nodoc:
               else
                 fk = reflection.primary_key_name
               end
-              
+
               assert associated_klass.column_names.include?(fk.to_s),
                      &quot;#{associated_klass.name} does not have a #{fk} foreign key.&quot;
             end
@@ -490,7 +435,7 @@ module ThoughtBot # :nodoc:
             reflection = klass.reflect_on_association(association)
             assert reflection, &quot;#{klass.name} does not have any relationship to #{association}&quot;
             assert_equal :has_one, reflection.macro
-            
+
             associated_klass = (reflection.options[:class_name] || association.to_s.camelize).constantize
 
             if reflection.options[:foreign_key]
@@ -498,17 +443,17 @@ module ThoughtBot # :nodoc:
             elsif reflection.options[:as]
               fk = reflection.options[:as].to_s.foreign_key
               fk_type = fk.gsub(/_id$/, '_type')
-              assert associated_klass.column_names.include?(fk_type), 
-                     &quot;#{associated_klass.name} does not have a #{fk_type} column.&quot;            
+              assert associated_klass.column_names.include?(fk_type),
+                     &quot;#{associated_klass.name} does not have a #{fk_type} column.&quot;
             else
               fk = klass.name.foreign_key
             end
-            assert associated_klass.column_names.include?(fk.to_s), 
-                   &quot;#{associated_klass.name} does not have a #{fk} foreign key.&quot;            
+            assert associated_klass.column_names.include?(fk.to_s),
+                   &quot;#{associated_klass.name} does not have a #{fk} foreign key.&quot;
           end
         end
       end
-  
+
       # Ensures that the has_and_belongs_to_many relationship exists, and that the join
       # table is in place.
       #
@@ -528,7 +473,7 @@ module ThoughtBot # :nodoc:
           end
         end
       end
-  
+
       # Ensure that the belongs_to relationship exists.
       #
       #   should_belong_to :parent
@@ -550,7 +495,7 @@ module ThoughtBot # :nodoc:
           end
         end
       end
-      
+
       # Ensure that the given class methods are defined on the model.
       #
       #   should_have_class_methods :find, :destroy
@@ -597,10 +542,10 @@ module ThoughtBot # :nodoc:
       end
 
       # Ensure that the given column is defined on the models backing SQL table.  The options are the same as
-      # the instance variables defined on the column definition:  :precision, :limit, :default, :null, 
+      # the instance variables defined on the column definition:  :precision, :limit, :default, :null,
       # :primary, :type, :scale, and :sql_type.
       #
-      #   should_have_db_column :email, :type =&gt; &quot;string&quot;, :default =&gt; nil,   :precision =&gt; nil, :limit    =&gt; 255, 
+      #   should_have_db_column :email, :type =&gt; &quot;string&quot;, :default =&gt; nil,   :precision =&gt; nil, :limit    =&gt; 255,
       #                                 :null =&gt; true,     :primary =&gt; false, :scale     =&gt; nil, :sql_type =&gt; 'varchar(255)'
       #
       def should_have_db_column(name, opts = {})
@@ -618,7 +563,7 @@ module ThoughtBot # :nodoc:
 
       # Ensures that there are DB indices on the given columns or tuples of columns.
       # Also aliased to should_have_index for readability
-      #   
+      #
       #   should_have_indices :email, :name, [:commentable_type, :commentable_id]
       #   should_have_index :age
       #
@@ -635,11 +580,11 @@ module ThoughtBot # :nodoc:
       end
 
       alias_method :should_have_index, :should_have_indices
-      
+
       # Ensures that the model cannot be saved if one of the attributes listed is not accepted.
       #
       # Options:
-      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.  
+      # * &lt;tt&gt;:message&lt;/tt&gt; - value the test expects to find in &lt;tt&gt;errors.on(:attribute)&lt;/tt&gt;.
       #   Regexp or string.  Default = &lt;tt&gt;/must be accepted/&lt;/tt&gt;
       #
       # Example:
@@ -649,21 +594,17 @@ module ThoughtBot # :nodoc:
         message = get_options!(attributes, :message)
         message ||= /must be accepted/
         klass = model_class
-    
+
         attributes.each do |attribute|
           should &quot;require #{attribute} to be accepted&quot; do
             object = klass.new
-            object.send(&quot;#{attribute}=&quot;, false)
-
-            assert !object.valid?, &quot;#{klass.name} does not require acceptance of #{attribute}.&quot;
-            assert object.errors.on(attribute), &quot;#{klass.name} does not require acceptance of #{attribute}.&quot;
-            assert_contains(object.errors.on(attribute), message)
+            assert_bad_value(object, attribute, false, message)
           end
         end
       end
-      
+
       private
-      
+
       include ThoughtBot::Shoulda::Private
     end
   end</diff>
      <filename>lib/shoulda/active_record_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -179,28 +179,28 @@ module ThoughtBot # :nodoc:
       end
 
       # Asserts that an Active Record model validates with the passed
-      # &lt;tt&gt;value&lt;/tt&gt; by making sure the &lt;tt&gt;message_to_avoid&lt;/tt&gt; is not
+      # &lt;tt&gt;value&lt;/tt&gt; by making sure the &lt;tt&gt;error_message_to_avoid&lt;/tt&gt; is not
       # contained within the list of errors for that attribute.
       #
       #   assert_good_value(User.new, :email, &quot;user@example.com&quot;) #=&gt; passes
       #   assert_good_value(User.new, :ssn, &quot;123456789&quot;, /length/) #=&gt; passes
-      def assert_good_value(object, attribute, value, message_to_avoid = //)
+      def assert_good_value(object, attribute, value, error_message_to_avoid = //)
         object.send(&quot;#{attribute}=&quot;, value)
         object.valid?
-        assert_does_not_contain(object.errors.on(attribute), message_to_avoid, &quot;when set to \&quot;#{value}\&quot;&quot;)
+        assert_does_not_contain(object.errors.on(attribute), error_message_to_avoid, &quot;when set to #{value.inspect}&quot;)
       end
 
       # Asserts that an Active Record model invalidates the passed
-      # &lt;tt&gt;value&lt;/tt&gt; by making sure the &lt;tt&gt;message_to_expect&lt;/tt&gt; is
+      # &lt;tt&gt;value&lt;/tt&gt; by making sure the &lt;tt&gt;error_message_to_expect&lt;/tt&gt; is
       # contained within the list of errors for that attribute.
       #
       #   assert_bad_value(User.new, :email, &quot;invalid&quot;) #=&gt; passes
       #   assert_bad_value(User.new, :ssn, &quot;123&quot;, /length/) #=&gt; passes
-      def assert_bad_value(object, attribute, value, message_to_expect = /invalid/)
+      def assert_bad_value(object, attribute, value, error_message_to_expect = /invalid/)
         object.send(&quot;#{attribute}=&quot;, value)
-        assert !object.valid?, &quot;#{object.class} allowed \&quot;#{value}\&quot; as a value for #{attribute}&quot;
-        assert object.errors.on(attribute), &quot;There are no errors set on #{attribute} after being set to \&quot;#{value}\&quot;&quot;
-        assert_contains(object.errors.on(attribute), message_to_expect, &quot;when set to \&quot;#{value}\&quot;&quot;)
+        assert !object.valid?, &quot;#{object.class} allowed #{value.inspect} as a value for #{attribute}&quot;
+        assert object.errors.on(attribute), &quot;There are no errors on #{attribute} after being set to #{value.inspect}&quot;
+        assert_contains(object.errors.on(attribute), error_message_to_expect, &quot;when set to #{value.inspect}&quot;)
       end
 
       def pretty_error_messages(obj)</diff>
      <filename>lib/shoulda/general.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ed36bc5125d07f600c4b556007044418cf1d3f70</id>
    </parent>
  </parents>
  <author>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </author>
  <url>http://github.com/showaltb/shoulda/commit/4c5768d1630bbfc522c6019eede33fb1b2e6c57f</url>
  <id>4c5768d1630bbfc522c6019eede33fb1b2e6c57f</id>
  <committed-date>2008-07-28T19:56:41-07:00</committed-date>
  <authored-date>2008-07-28T19:56:41-07:00</authored-date>
  <message>DRY'd up Active Record macro helpers</message>
  <tree>5576295b7c999b4ee3aff703da0896f7c5c0c157</tree>
  <committer>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </committer>
</commit>
