<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 module Huberry
   module ValidatesAsHostnameLabel
+    
+    RESERVED_HOSTNAMES = %w(www blog dev stage stats status admin ftp sftp mail pop pop3 imap smtp)
+    
     # Checks for:
     #
     #   * Length between 1 and 63 characters long
@@ -9,7 +12,7 @@ module Huberry
     #
     # Accepts an :allow_underscores option which defaults to false
     def validates_as_hostname_label(*attrs)
-      options = { :allow_underscores =&gt; false, :reserved =&gt; [] }.merge(attrs.last.is_a?(Hash) ? attrs.pop : {})
+      options = { :allow_underscores =&gt; false, :reserved =&gt; RESERVED_HOSTNAMES }.merge(attrs.last.is_a?(Hash) ? attrs.pop : {})
       
       format = 'a-z0-9\-'
       format &lt;&lt; '_' if options.delete(:allow_underscores)</diff>
      <filename>lib/validates_as_hostname_label.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ class Account &lt; ActiveRecord::Base
   validates_as_hostname_label :subdomain_with_underscores, :allow_underscores =&gt; true
   validates_as_hostname_label :subdomain_with_blank, :allow_blank =&gt; true
   validates_as_hostname_label :subdomain_with_nil, :allow_nil =&gt; true
-  validates_as_hostname_label :subdomain_with_reserved, :reserved =&gt; ['www']
+  validates_as_hostname_label :subdomain_with_reserved, :reserved =&gt; ['funky']
 end
 
 class ValidatesAsHostnameLabelTest &lt; Test::Unit::TestCase
@@ -100,10 +100,24 @@ class ValidatesAsHostnameLabelTest &lt; Test::Unit::TestCase
     assert @account.save
   end
   
-  def test_should_not_save_with_a_reserved_subdomain
-    @account = Account.new :subdomain_with_reserved =&gt; 'www'
+  def test_should_not_save_with_a_reserved_subdomain_from_the_default_list
+    Huberry::ValidatesAsHostnameLabel::RESERVED_HOSTNAMES.each do |hostname|
+      @account = Account.new :subdomain =&gt; hostname
+      assert !@account.save
+      assert @account.errors.on(:subdomain)
+    end
+  end
+
+  def test_should_not_save_with_a_reserved_subdomain_from_a_list
+    @account = Account.new :subdomain_with_reserved =&gt; 'funky'
     assert !@account.save
     assert @account.errors.on(:subdomain_with_reserved)
   end
   
+  def test_should_not_be_valid_with_a_subdomain_not_from_the_list
+    @account = Account.new :subdomain_with_reserved =&gt; 'qqqfds'
+    assert !@account.save
+    assert !@account.errors.on(:subdomain_with_reserved)
+  end
+  
 end
\ No newline at end of file</diff>
      <filename>test/validates_as_hostname_label_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5a19ee2fb796926fd942671c81e2875a16725279</id>
    </parent>
  </parents>
  <author>
    <name>Anders T&#246;rnqvist</name>
    <email>anders@elabs.se</email>
  </author>
  <url>http://github.com/shuber/validates_as_hostname_label/commit/fc2e66593e43e89ae108e4bd574d8a9689abdda5</url>
  <id>fc2e66593e43e89ae108e4bd574d8a9689abdda5</id>
  <committed-date>2009-06-05T11:25:13-07:00</committed-date>
  <authored-date>2009-06-02T08:14:57-07:00</authored-date>
  <message>Add a default for the :reserved option

Signed-off-by: Sean Huber &lt;shuber@huberry.com&gt;</message>
  <tree>9ab525f62d75ae3edf69df6c68f938ea630ef4e4</tree>
  <committer>
    <name>Sean Huber</name>
    <email>shuber@huberry.com</email>
  </committer>
</commit>
