Sha256: 97d1429655897896f84bea0217ae572388b51599b53743a0a6568a2d70928ca0
Contents?: true
Size: 862 Bytes
Versions: 1
Compression:
Stored size: 862 Bytes
Contents
require File.dirname(__FILE__)+'/test_helper' class HasCommentsTest < ActiveSupport::TestCase load_schema class Article < ActiveRecord::Base has_comments end class Comment < ActiveRecord::Base belongs_to :comment, :polymorphic => true end def setup @article = Article.create!({:title => "title", :content => "content"}) @first_comment = Comment.create!({:title => "title", :content => "content", :comment => @article}) @second_comment = Comment.create!({:title => "title", :content => "content", :comment => @article}) end def test_existence_for_first_comments_method assert_equal 2, @article.first_2_comments.count end def test_existence_for_last_comments_method assert_equal 2, @article.last_2_comments.count end def teardown @article.comments.destroy_all @article.destroy end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
has_comments-0.3.0 | test/has_comments_test.rb |