public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Documented DestroyAssociated
Michael Hartl (author)
Thu May 01 13:09:57 -0700 2008
commit  e9902ec9df9fb48a99a5aeea1bb0de19fd5373e0
tree    826bbdad905b852f6efe58dd2f4186e345f2fab8
parent  9a382752686b1bf3b8d60acf208f621675e72650
...
49
50
51
 
 
 
52
53
54
55
56
57
58
59
 
 
60
61
62
 
63
64
65
...
49
50
51
52
53
54
55
56
57
58
59
60
 
 
61
62
63
64
 
65
66
67
68
0
@@ -49,17 +49,20 @@ module CustomModelMatchers
0
   
0
   
0
   # Verify that an action destroys an associated attribute.
0
+ # Usage:
0
+ # @topic.should destroy_associated(:posts)
0
+
0
   class DestroyAssociated
0
 
0
     def initialize(attribute)
0
       @attribute = attribute
0
     end
0
 
0
- def matches?(model)
0
- objects = model.send(@attribute)
0
+ def matches?(parent)
0
+ objects = parent.send(@attribute)
0
       # Objects must exist in the first place.
0
       raise ArgumentError, "Invalid initial association" unless found?(objects)
0
- model.destroy
0
+ parent.destroy
0
       not found?(objects)
0
     end
0
     

Comments

    No one has commented yet.