From 0c8b097a06462285c117d90065dce2941678b86c Mon Sep 17 00:00:00 2001 From: Junior Silva Date: Fri, 23 May 2014 15:31:06 -0300 Subject: [PATCH] topic-forum: implemented final test to author topic permissions AI3135 --- test/functional/content_viewer_controller_test.rb | 26 ++++++++++++++++++++++++-- test/unit/article_test.rb | 2 ++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 675b599..61628bb 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -896,12 +896,34 @@ class ContentViewerControllerTest < ActionController::TestCase should 'display icon-edit button to author topic' do community = fast_create(Community) - author = fast_create(Person) + admin = fast_create(Person) + community.add_member(admin) + author = create_user('author').person community.add_member(author) + forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') post = fast_create(TextileArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :last_changed_by_id => author.id) - assert_select 'div#article-actions' + login_as(author.identifier) + get :view_page, :profile => community.identifier, :page => post.path.split('/') + + assert_select "div#article-actions a.icon-edit" + end + + should 'display icon-delete button to author topic' do + community = fast_create(Community) + admin = fast_create(Person) + community.add_member(admin) + author = create_user('author').person + community.add_member(author) + + forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') + post = fast_create(TextileArticle, :name => 'First post', :profile_id => community.id, :parent_id => forum.id, :last_changed_by_id => author.id) + + login_as(author.identifier) + get :view_page, :profile => community.identifier, :page => post.path.split('/') + + assert_select "div#article-actions a.icon-delete" end should 'add meta tag to rss feed on view forum' do diff --git a/test/unit/article_test.rb b/test/unit/article_test.rb index fa241f5..990e9df 100644 --- a/test/unit/article_test.rb +++ b/test/unit/article_test.rb @@ -1663,6 +1663,8 @@ class ArticleTest < ActiveSupport::TestCase should 'allow author to edit topic' do community = fast_create(Community) + admin = fast_create(Person) + community.add_member(admin) author = fast_create(Person) community.add_member(author) forum = Forum.create(:profile => community, :name => 'Forum test', :body => 'Forum test') -- libgit2 0.21.2