<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/fixtures/friendships.yml</filename>
    </added>
    <added>
      <filename>test/rails_root/app/models/friendship.rb</filename>
    </added>
    <added>
      <filename>test/rails_root/db/migrate/010_create_friendships.rb</filename>
    </added>
    <added>
      <filename>test/unit/friendship_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -20,7 +20,7 @@ module ThoughtBot # :nodoc:
     # For all of these helpers, the last parameter may be a hash of options.
     #
     module ActiveRecord
-      # Ensures that the model cannot be saved if one of the attributes listed is not present.  
+      # Ensures that the model cannot be saved if one of the attributes listed is not present.
       #
       # If an instance variable has been created in the setup named after the
       # model being tested, then this method will use that.  Otherwise, it will
@@ -395,11 +395,6 @@ module ThoughtBot # :nodoc:
             assert reflection, &quot;#{klass.name} does not have any relationship to #{association}&quot;
             assert_equal :has_many, reflection.macro
 
-            associated_klass_name = reflection.options[:class_name]
-            associated_klass_name = reflection.options[:source].to_s.classify if associated_klass_name.blank?
-            associated_klass_name = association.to_s.classify                 if associated_klass_name.blank?
-            associated_klass = associated_klass_name.constantize
-
             if through
               through_reflection = klass.reflect_on_association(through)
               assert through_reflection, &quot;#{klass.name} does not have any relationship to #{through}&quot;
@@ -409,7 +404,7 @@ module ThoughtBot # :nodoc:
             if dependent
               assert_equal dependent.to_s,
                            reflection.options[:dependent].to_s,
-                           &quot;#{associated_klass.name} should have #{dependent} dependency&quot;
+                           &quot;#{association} should have #{dependent} dependency&quot;
             end
 
             # Check for the existence of the foreign key on the other table
@@ -422,6 +417,9 @@ module ThoughtBot # :nodoc:
                 fk = reflection.primary_key_name
               end
 
+              associated_klass_name = (reflection.options[:class_name] || association.to_s.classify)
+              associated_klass = associated_klass_name.constantize
+
               assert associated_klass.column_names.include?(fk.to_s),
                      &quot;#{associated_klass.name} does not have a #{fk} foreign key.&quot;
             end</diff>
      <filename>lib/shoulda/active_record_helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,16 +2,19 @@ class User &lt; ActiveRecord::Base
   has_many :posts
   has_many :dogs, :foreign_key =&gt; :owner_id
 
+  has_many :friendships
+  has_many :friends, :through =&gt; :friendships
+
   has_one :address, :as =&gt; :addressable
 
   named_scope :old,      :conditions =&gt; &quot;age &gt; 50&quot;
   named_scope :eighteen, :conditions =&gt; { :age =&gt; 18 }
   named_scope :recent,   lambda {|count| { :limit =&gt; count } }
-  
+
   def self.recent_via_method(count)
     scoped(:limit =&gt; count)
   end
-  
+
   attr_protected :password
   attr_readonly :name
 </diff>
      <filename>test/rails_root/app/models/user.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,9 @@ class UserTest &lt; Test::Unit::TestCase
   should_have_many :posts
   should_have_many :dogs
 
+  should_have_many :friendships
+  should_have_many :friends
+
   should_have_one :address
 
   should_have_indices :email, :name, [:email, :name]
@@ -13,7 +16,7 @@ class UserTest &lt; Test::Unit::TestCase
 
   should_have_named_scope :old,       :conditions =&gt; &quot;age &gt; 50&quot;
   should_have_named_scope :eighteen,  :conditions =&gt; { :age =&gt; 18 }
-  
+
   should_have_named_scope 'recent(5)',            :limit =&gt; 5
   should_have_named_scope 'recent(1)',            :limit =&gt; 1
   should_have_named_scope 'recent_via_method(7)', :limit =&gt; 7
@@ -32,11 +35,11 @@ class UserTest &lt; Test::Unit::TestCase
   should_have_instance_methods :email, :age, :email=, :valid?
   should_have_db_columns :name, :email, :age
   should_have_db_column :id, :type =&gt; &quot;integer&quot;, :primary =&gt; true
-  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)'
   should_require_acceptance_of :eula
   should_require_unique_attributes :email, :scoped_to =&gt; :name
-  
+
   should_ensure_length_is :ssn, 9, :message =&gt; &quot;Social Security Number is not the right length&quot;
   should_only_allow_numeric_values_for :ssn
 </diff>
      <filename>test/unit/user_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5411ccf9765ac517fb5079818e84304be2d96b94</id>
    </parent>
  </parents>
  <author>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </author>
  <url>http://github.com/thoughtbot/shoulda/commit/68e42610bed1a1caf0a2bb5fe73f72ccd5e44e89</url>
  <id>68e42610bed1a1caf0a2bb5fe73f72ccd5e44e89</id>
  <committed-date>2008-08-31T09:14:16-07:00</committed-date>
  <authored-date>2008-08-31T09:14:16-07:00</authored-date>
  <message>Fixed should_have_many regression [#60]

 * Removed the check for the :source option on the assocation as it did not always yield the correct class name
 * Added tests to prevent the regression again</message>
  <tree>d4f6a49d7569af4b0763a1ea1a46129fe6398f1c</tree>
  <committer>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </committer>
</commit>
