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
fixing db

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@191 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
tsaleh (author)
Fri Aug 24 12:30:31 -0700 2007
commit  8c9c760a26e0a9efc1adb0cc59c07c6998b3429a
tree    89ca933913b4f8367735a762a160eda5345b33f1
parent  0f194fb28ab8ecae8703734533387244757c53a8
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ require 'rake'
0
 require 'rake/testtask'
0
 require 'rake/rdoctask'
0
 
0
-require 'lib/tasks/list_tests.rb'
0
+#require 'tasks/list_tests.rake'
0
 
0
 # Test::Unit::UI::VERBOSE
0
 
...
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
- get_options!(associations)
0
+ fk = get_options!(associations, :foreign_key)
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
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 class CreateTaggings < ActiveRecord::Migration
0
   def self.up
0
     create_table :taggings do |t|
0
- t.column :user_id, :integer
0
+ t.column :post_id, :integer
0
       t.column :tag_id, :integer
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
0
+ should_belong_to :post, :foreign_key
0
   should_belong_to :tag
0
 end

Comments

    No one has commented yet.