<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -129,6 +129,28 @@ module ThoughtBot # :nodoc:
         end
       end
   
+      # Ensures that the attribute cannot be changed once the record has been created.
+      # Requires an existing record.
+      #
+      #   should_have_readonly_attributes :password, :admin_flag
+      #
+      def should_have_readonly_attributes(*attributes)
+        get_options!(attributes)
+        klass = model_class
+
+        attributes.each do |attribute|
+          attribute = attribute.to_sym
+          should &quot;make #{attribute} read-only&quot; do
+            readonly = klass.readonly_attributes || []
+
+            assert readonly.include?(attribute.to_s),
+                   (readonly.empty? ?
+                     &quot;#{klass} attribute #{attribute} is not read-only&quot; :
+                     &quot;#{klass} is making #{readonly.to_a.to_sentence} read-only, but not #{attribute}.&quot;)
+          end
+        end
+      end
+
       # Ensures that the attribute cannot be set to the given values
       # Requires an existing record
       #</diff>
      <filename>lib/shoulda/active_record_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,7 @@ class User &lt; ActiveRecord::Base
   has_one :address, :as =&gt; :addressable
   
   attr_protected :password
+  attr_readonly :name
 
   validates_format_of :email, :with =&gt; /\w*@\w*.com/
   validates_length_of :email, :in =&gt; 1..100</diff>
      <filename>test/rails_root/app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,4 +24,5 @@ class UserTest &lt; Test::Unit::TestCase
                                 :null =&gt; true,     :primary =&gt; false, :scale     =&gt; nil, :sql_type =&gt; 'varchar(255)'
   should_require_acceptance_of :eula
   should_require_unique_attributes :email, :scoped_to =&gt; :name
+  should_have_readonly_attributes :name
 end</diff>
      <filename>test/unit/user_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>74e76ae7e846a15ea5809293eccda551e9cdedc4</id>
    </parent>
  </parents>
  <author>
    <name>Mike Boone</name>
    <email>mike@boonedocks.net</email>
  </author>
  <url>http://github.com/boone/shoulda/commit/5eb9304489af5cb0314c971b55fe6fb75a0741b4</url>
  <id>5eb9304489af5cb0314c971b55fe6fb75a0741b4</id>
  <committed-date>2008-06-24T12:50:38-07:00</committed-date>
  <authored-date>2008-06-24T12:50:38-07:00</authored-date>
  <message>Added should_have_readonly_attributes

Added should_have_readonly_attributes ActiveRecord helper to
test attributes set with attr_readonly.</message>
  <tree>da6b4a6eb89d1598b1ce8ce9b6c42b480175f8f2</tree>
  <committer>
    <name>Mike Boone</name>
    <email>mike@boonedocks.net</email>
  </committer>
</commit>
