def should_validate_attachment_size name, options = {}
      klass   = self.name.gsub(/Test$/, '').constantize
      min     = options[:greater_than] || (options[:in] && options[:in].first) || 0
      max     = options[:less_than]    || (options[:in] && options[:in].last)  || (1.0/0)
      range   = (min..max)
      matcher = validate_attachment_size(name).in(range)
      should matcher.description do
        assert_accepts(matcher, klass)
      end
    end
def should_validate_attachment_size name, options = {}
      klass   = self.name.gsub(/Test$/, '').constantize
      min     = options[:greater_than] || (options[:in] && options[:in].first) || 0
      max     = options[:less_than]    || (options[:in] && options[:in].last)  || (1.0/0)
      range   = (min..max)
      matcher = validate_attachment_size(name).in(range)
      should matcher.description do
        assert_accepts(matcher, klass)
      end
    end
Tests to ensure that you have file size validations turned on. You
 can pass the same options to this that you can to
 validate_attachment_file_size - :less_than, :greater_than, and :in.
 :less_than checks that a file is less than a certain size, :greater_than
 checks that a file is more than a certain size, and :in takes a Range or
 Array which specifies the lower and upper limits of the file size.