Commit 17b7902f6c51dcc48eee2b138f4adedbf4c06cd1

Authored by Victor Costa
1 parent c3b21dab

comment_paragraph: fix tests

plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb
... ... @@ -37,29 +37,32 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase
37 37 end
38 38  
39 39 should 'display button to toggle comment paragraph for users which can edit the article' do
40   - article = fast_create(Article)
  40 + profile = fast_create(Profile)
  41 + article = fast_create(Article, :profile_id => profile.id)
41 42 article.expects(:comment_paragraph_plugin_enabled?).returns(true)
42 43 article.expects(:allow_edit?).with(user).returns(true)
43 44  
44   - content = plugin.article_header_extra_contents(article)
  45 + content = plugin.article_toolbar_actions(article)
45 46 expects(:button).once
46 47 instance_eval(&content)
47 48 end
48 49  
49 50 should 'not display button to toggle comment paragraph for users which can not edit the article' do
50   - article = fast_create(Article)
  51 + profile = fast_create(Profile)
  52 + article = fast_create(Article, :profile_id => profile.id)
51 53 article.expects(:comment_paragraph_plugin_enabled?).returns(true)
52 54 article.expects(:allow_edit?).with(user).returns(false)
53 55  
54   - content = plugin.article_header_extra_contents(article)
  56 + content = plugin.article_toolbar_actions(article)
55 57 assert_equal nil, instance_eval(&content)
56 58 end
57 59  
58 60 should 'not display button to toggle comment paragraph if plugin is not enabled' do
59   - article = fast_create(Article)
  61 + profile = fast_create(Profile)
  62 + article = fast_create(Article, :profile_id => profile.id)
60 63 article.expects(:comment_paragraph_plugin_enabled?).returns(false)
61 64  
62   - assert_equal nil, plugin.article_header_extra_contents(article)
  65 + assert_equal nil, plugin.article_toolbar_actions(article)
63 66 end
64 67  
65 68 end
... ...