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