Commit 74d6707176fc402184f60964f2f477461fea4b5c
1 parent
f933ebfd
Exists in
forum_topic_creation
Adds tests to forum topic creation
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
1 changed file
with
44 additions
and
0 deletions
Show diff stats
test/functional/cms_controller_test.rb
... | ... | @@ -1619,6 +1619,50 @@ class CmsControllerTest < ActionController::TestCase |
1619 | 1619 | assert_tag :tag => 'input', :attributes => {:name => 'article[accept_comments]', :value => 1, :type => 'checkbox'} |
1620 | 1620 | end |
1621 | 1621 | |
1622 | + should 'logged in user NOT be able to create topic on forum when topic creation is set to Me' do | |
1623 | + u = create_user('linux') | |
1624 | + login_as :linux | |
1625 | + profile.articles << f = Forum.new(:name => 'Forum for test', | |
1626 | + :topic_creation => 'self', | |
1627 | + :body => 'Forum Body') | |
1628 | + | |
1629 | + post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1630 | + :article => {:name => 'New Topic by linux', :body => 'Article Body', | |
1631 | + :parent_id => f.id} | |
1632 | + | |
1633 | + assert_template :access_denied | |
1634 | + assert_not_equal 'New Topic by linux', Article.last.name | |
1635 | + end | |
1636 | + | |
1637 | + should 'logged in user NOT be able to create topic on forum when topic creation is set to Friends/Members' do | |
1638 | + u = create_user('linux') | |
1639 | + login_as :linux | |
1640 | + profile.articles << f = Forum.new(:name => 'Forum for test', | |
1641 | + :topic_creation => 'related', | |
1642 | + :body => 'Forum Body') | |
1643 | + | |
1644 | + post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1645 | + :article => {:name => 'New Topic by linux', :body => 'Article Body', | |
1646 | + :parent_id => f.id} | |
1647 | + | |
1648 | + assert_template :access_denied | |
1649 | + assert_not_equal 'New Topic by linux', Article.last.name | |
1650 | + end | |
1651 | + | |
1652 | + should 'logged in user be able to create topic on forum when topic creation is set to Logged in users' do | |
1653 | + u = create_user('linux') | |
1654 | + login_as :linux | |
1655 | + profile.articles << f = Forum.new(:name => 'Forum for test', | |
1656 | + :topic_creation => 'users', | |
1657 | + :body => 'Forum Body') | |
1658 | + | |
1659 | + post :new, :profile => profile.identifier, :type => 'TinyMceArticle', | |
1660 | + :article => {:name => 'New Topic by linux', :body => 'Article Body', | |
1661 | + :parent_id => f.id} | |
1662 | + | |
1663 | + assert_equal 'New Topic by linux', Article.last.name | |
1664 | + end | |
1665 | + | |
1622 | 1666 | should 'display accept comments option when editing forum post with a different label' do |
1623 | 1667 | profile.articles << f = Forum.new(:name => 'Forum for test') |
1624 | 1668 | profile.articles << a = TinyMceArticle.new(:name => 'Forum post for test', :parent => f) | ... | ... |