Commit fc5eba870193a5b056de78470537c616492c91cc
Exists in
master
and in
28 other branches
Merge commit 'bedad5b'
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
test/unit/article_test.rb
... | ... | @@ -1749,4 +1749,24 @@ class ArticleTest < ActiveSupport::TestCase |
1749 | 1749 | assert_nil article.author_id |
1750 | 1750 | end |
1751 | 1751 | |
1752 | + should 'identify if belongs to forum' do | |
1753 | + p = create_user('user_forum_test').person | |
1754 | + forum = fast_create(Forum, :name => 'Forum test', :profile_id => p.id) | |
1755 | + post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
1756 | + assert post.belongs_to_forum? | |
1757 | + end | |
1758 | + | |
1759 | + should 'not belongs to forum' do | |
1760 | + p = create_user('user_forum_test').person | |
1761 | + blog = fast_create(Blog, :name => 'Not Forum', :profile_id => p.id) | |
1762 | + a = fast_create(TextileArticle, :name => 'Not forum post', :profile_id => p.id, :parent_id => blog.id) | |
1763 | + assert !a.belongs_to_forum? | |
1764 | + end | |
1765 | + | |
1766 | + should 'not belongs to forum if do not have a parent' do | |
1767 | + p = create_user('user_forum_test').person | |
1768 | + a = fast_create(TextileArticle, :name => 'Orphan post', :profile_id => p.id) | |
1769 | + assert !a.belongs_to_forum? | |
1770 | + end | |
1771 | + | |
1752 | 1772 | end | ... | ... |