Commit bedad5b3f01a1aed2a0c0e1b65b36736e4e83afa
1 parent
8dbebef1
Exists in
master
and in
28 other branches
Adding tests for article belongs_to_forum method
Showing
1 changed file
with
20 additions
and
0 deletions
Show diff stats
test/unit/article_test.rb
... | ... | @@ -1833,4 +1833,24 @@ class ArticleTest < ActiveSupport::TestCase |
1833 | 1833 | assert_nil article.author_id |
1834 | 1834 | end |
1835 | 1835 | |
1836 | + should 'identify if belongs to forum' do | |
1837 | + p = create_user('user_forum_test').person | |
1838 | + forum = fast_create(Forum, :name => 'Forum test', :profile_id => p.id) | |
1839 | + post = fast_create(TextileArticle, :name => 'First post', :profile_id => p.id, :parent_id => forum.id) | |
1840 | + assert post.belongs_to_forum? | |
1841 | + end | |
1842 | + | |
1843 | + should 'not belongs to forum' do | |
1844 | + p = create_user('user_forum_test').person | |
1845 | + blog = fast_create(Blog, :name => 'Not Forum', :profile_id => p.id) | |
1846 | + a = fast_create(TextileArticle, :name => 'Not forum post', :profile_id => p.id, :parent_id => blog.id) | |
1847 | + assert !a.belongs_to_forum? | |
1848 | + end | |
1849 | + | |
1850 | + should 'not belongs to forum if do not have a parent' do | |
1851 | + p = create_user('user_forum_test').person | |
1852 | + a = fast_create(TextileArticle, :name => 'Orphan post', :profile_id => p.id) | |
1853 | + assert !a.belongs_to_forum? | |
1854 | + end | |
1855 | + | |
1836 | 1856 | end | ... | ... |