Add the has_many_polymorphs plugin
[cs356-p2-videostore.git] / vendor / plugins / has_many_polymorphs / generators / commenting / templates / commenting_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class CommentingTest < Test::Unit::TestCase
4   fixtures :commentings, :comments, <%= commentable_models[0..1].join(", ") -%>
5
6   def setup
7     @obj1 = <%= model_two %>.find(1)
8     @obj2 = <%= model_two %>.find(2)
9 <% if commentable_models.size > 1 -%>
10     @obj3 = <%= model_one -%>.find(1)
11 <% end -%>
12     @comment1 = Comment.find(1)  
13     @comment2 = Comment.find(2)  
14     @commenting1 = Commenting.find(1)
15   end
16
17   def test_commentable
18     assert_raises(RuntimeError) do 
19       @commenting1.send(:commentable?, true) 
20     end
21     assert !@commenting1.send(:commentable?)
22 <% if commentable_models.size > 1 -%>
23     assert @obj3.send(:commentable?)
24 <% end -%>
25 <% if options[:self_referential] -%>  
26     assert @comment1.send(:commentable?)
27 <% end -%>    
28   end
29     
30 end