public
Rubygem
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/thoughtbot/shoulda.git
fixed test schema

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@192 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
tsaleh (author)
Fri Aug 24 12:34:50 -0700 2007
commit  b070ab599356e010bdb73010acab73948bc00d5f
tree    62ca4169009a4d0bf3a67dd3aa5d9f0fadf2eecd
parent  8c9c760a26e0a9efc1adb0cc59c07c6998b3429a
...
317
318
319
320
 
321
322
323
324
325
326
327
 
328
329
330
...
317
318
319
 
320
321
322
323
324
325
326
 
327
328
329
330
0
@@ -317,14 +317,14 @@ module ThoughtBot # :nodoc:
0
       #
0
       # should_belong_to :parent
0
       def should_belong_to(*associations)
0
- fk = get_options!(associations, :foreign_key)
0
+ get_options!(associations)
0
         klass = model_class
0
         associations.each do |association|
0
           should "belong_to #{association}" do
0
             reflection = klass.reflect_on_association(association)
0
             assert reflection, "#{klass.name} does not have any relationship to #{association}"
0
             assert_equal :belongs_to, reflection.macro
0
- fk ||= (reflection.options[:foreign_key] || "#{association}_id")
0
+ fk = reflection.options[:foreign_key] || "#{association}_id"
0
             assert klass.column_names.include?(fk), "#{klass.name} does not have a #{fk} foreign key."
0
           end
0
         end
...
3
4
5
6
 
7
8
...
3
4
5
 
6
7
8
0
@@ -3,6 +3,6 @@ require File.dirname(__FILE__) + '/../test_helper'
0
 class TaggingTest < Test::Unit::TestCase
0
   load_all_fixtures
0
 
0
- should_belong_to :post, :foreign_key
0
+ should_belong_to :post
0
   should_belong_to :tag
0
 end

Comments

    No one has commented yet.