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
Better named the should clause for should_have_one when the :dependent 
option is in use [#81]
rmm5t (author)
Wed Sep 17 13:16:41 -0700 2008
commit  a692f6d882c51679d6fb6292647a9e88a19da132
tree    854d8dc39b73cee896476a8a0bcd4c608c25987c
parent  829ebafba0e07795eeea9098f7661263597a7eb5
...
457
458
459
460
 
 
 
461
462
463
...
476
477
478
479
 
480
481
482
...
457
458
459
 
460
461
462
463
464
465
...
478
479
480
 
481
482
483
484
0
@@ -457,7 +457,9 @@ module ThoughtBot # :nodoc:
0
           dependent = get_options!(associations, :dependent)
0
           klass = model_class
0
           associations.each do |association|
0
- should "have one #{association}" do
0
+ name = "have one #{association}"
0
+ name += " dependent => #{dependent}" if dependent
0
+ should name do
0
               reflection = klass.reflect_on_association(association)
0
               assert reflection, "#{klass.name} does not have any relationship to #{association}"
0
               assert_equal :has_one, reflection.macro
0
@@ -476,7 +478,7 @@ module ThoughtBot # :nodoc:
0
               end
0
               assert associated_klass.column_names.include?(fk.to_s),
0
                      "#{associated_klass.name} does not have a #{fk} foreign key."
0
-
0
+
0
               if dependent
0
                 assert_equal dependent.to_s,
0
                              reflection.options[:dependent].to_s,
...
9
10
11
 
12
13
14
...
9
10
11
12
13
14
15
0
@@ -9,6 +9,7 @@ class UserTest < Test::Unit::TestCase
0
   should_have_many :friendships
0
   should_have_many :friends
0
 
0
+ should_have_one :address
0
   should_have_one :address, :dependent => :destroy
0
 
0
   should_have_indices :email, :name, [:email, :name]

Comments

    No one has commented yet.