From c51cb5d886412ea8013bfbd8276ae34544dc8115 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Mon, 9 Mar 2015 09:08:16 -0300 Subject: [PATCH] comment_paragraph: fix tests --- test/unit/comment_paragraph_plugin_test.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/unit/comment_paragraph_plugin_test.rb b/test/unit/comment_paragraph_plugin_test.rb index ad98d64..cac7a8a 100644 --- a/test/unit/comment_paragraph_plugin_test.rb +++ b/test/unit/comment_paragraph_plugin_test.rb @@ -37,29 +37,32 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase end should 'display button to toggle comment paragraph for users which can edit the article' do - article = fast_create(Article) + profile = fast_create(Profile) + article = fast_create(Article, :profile_id => profile.id) article.expects(:comment_paragraph_plugin_enabled?).returns(true) article.expects(:allow_edit?).with(user).returns(true) - content = plugin.article_header_extra_contents(article) + content = plugin.article_toolbar_actions(article) expects(:button).once instance_eval(&content) end should 'not display button to toggle comment paragraph for users which can not edit the article' do - article = fast_create(Article) + profile = fast_create(Profile) + article = fast_create(Article, :profile_id => profile.id) article.expects(:comment_paragraph_plugin_enabled?).returns(true) article.expects(:allow_edit?).with(user).returns(false) - content = plugin.article_header_extra_contents(article) + content = plugin.article_toolbar_actions(article) assert_equal nil, instance_eval(&content) end should 'not display button to toggle comment paragraph if plugin is not enabled' do - article = fast_create(Article) + profile = fast_create(Profile) + article = fast_create(Article, :profile_id => profile.id) article.expects(:comment_paragraph_plugin_enabled?).returns(false) - assert_equal nil, plugin.article_header_extra_contents(article) + assert_equal nil, plugin.article_toolbar_actions(article) end end -- libgit2 0.21.2