<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -79,25 +79,31 @@ module Shoulda # :nodoc:
       # * &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;I18n.translate('activerecord.errors.messages.taken')&lt;/tt&gt;
       # * &lt;tt&gt;:scoped_to&lt;/tt&gt; - field(s) to scope the uniqueness to.
+      # * &lt;tt&gt;:case_sensitive&lt;/tt&gt; - whether or not the value should match case sensitively.
+      #   Use &lt;tt&gt;true&lt;/tt&gt; to explicitly test for a case sensitive match.
+      #   Use &lt;tt&gt;false&lt;/tt&gt; to explicitly test for a case insensitive match.
+      #   Default = &lt;tt&gt;true&lt;/tt&gt;.
       #
       # Examples:
       #   should_require_unique_attributes :keyword, :username
       #   should_require_unique_attributes :name, :message =&gt; &quot;O NOES! SOMEONE STOELED YER NAME!&quot;
       #   should_require_unique_attributes :email, :scoped_to =&gt; :name
       #   should_require_unique_attributes :address, :scoped_to =&gt; [:first_name, :last_name]
+      #   should_require_unique_attributes :email, :case_sensitive =&gt; false
       #
       def should_require_unique_attributes(*attributes)
-        message, scope = get_options!(attributes, :message, :scoped_to)
+        message, scope, case_sensitive = get_options!(attributes, :message, :scoped_to, :case_sensitive)
         scope = [*scope].compact
         message ||= default_error_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
+          should &quot;require#{' case insensitive' if case_sensitive == false} 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
             existing_value = existing.send(attribute)
+            existing_value.swapcase! if case_sensitive == false &amp;&amp; existing_value.respond_to?(:swapcase!)
 
             if !scope.blank?
               scope.each do |s|
@@ -105,6 +111,7 @@ module Shoulda # :nodoc:
                 object.send(&quot;#{s}=&quot;, existing.send(s))
               end
             end
+            
             assert_bad_value(object, attribute, existing_value, message)
 
             # Now test that the object is valid when changing the scoped attribute</diff>
      <filename>lib/shoulda/active_record/macros.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@ class Post &lt; ActiveRecord::Base
   has_many :through_tags, :through =&gt; :taggings, :source =&gt; :tag
 
   validates_uniqueness_of :title
+  validates_uniqueness_of :title, :case_sensitive =&gt; false
   validates_presence_of :title
   validates_presence_of :body, :message =&gt; 'Seriously...  wtf'
   validates_numericality_of :user_id</diff>
      <filename>test/rails_root/app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,6 +9,7 @@ class PostTest &lt; Test::Unit::TestCase
   should_have_many :through_tags, :through =&gt; :taggings
 
   should_require_unique_attributes :title
+  should_require_unique_attributes :title, :case_sensitive =&gt; false
   should_require_attributes :body, :message =&gt; /wtf/
   should_require_attributes :title
   should_only_allow_numeric_values_for :user_id</diff>
      <filename>test/unit/post_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1e74f34536b49a02be919e3fdba062b6d719edfa</id>
    </parent>
  </parents>
  <author>
    <name>Lawrence Pit</name>
    <email>lawrence.pit@gmail.com</email>
  </author>
  <url>http://github.com/thoughtbot/shoulda/commit/d8fe1caeb9626ccba20d4c936910dfd4e6fbd557</url>
  <id>d8fe1caeb9626ccba20d4c936910dfd4e6fbd557</id>
  <committed-date>2009-01-10T11:49:37-08:00</committed-date>
  <authored-date>2009-01-10T04:15:04-08:00</authored-date>
  <message>Added case_sensitive option to should_require_unique_attributes call [#130]</message>
  <tree>c312f67c75961ee7e57cd2786d71dc7aa164f795</tree>
  <committer>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </committer>
</commit>
