Commit c62c8359c6d75ac648a6be74367352f4422d98e8
1 parent
60ddbaf0
Exists in
staging
and in
3 other branches
comment_paragraph: fix tests
Showing
1 changed file
with
12 additions
and
2 deletions
Show diff stats
plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb
| @@ -71,7 +71,7 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase | @@ -71,7 +71,7 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase | ||
| 71 | article.expects(:allow_edit?).with(user).returns(true) | 71 | article.expects(:allow_edit?).with(user).returns(true) |
| 72 | article.expects(:comment_paragraph_plugin_activated?).returns(false) | 72 | article.expects(:comment_paragraph_plugin_activated?).returns(false) |
| 73 | 73 | ||
| 74 | - assert_equal 'Activate Comments', plugin.article_extra_toolbar_buttons(article)[:title] | 74 | + assert_equal 'Activate Comments', plugin.article_extra_toolbar_buttons(article).first[:title] |
| 75 | end | 75 | end |
| 76 | 76 | ||
| 77 | should 'display Deactivate Comments title if comment paragraph plugin is deactivated' do | 77 | should 'display Deactivate Comments title if comment paragraph plugin is deactivated' do |
| @@ -81,7 +81,17 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase | @@ -81,7 +81,17 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase | ||
| 81 | article.expects(:allow_edit?).with(user).returns(true) | 81 | article.expects(:allow_edit?).with(user).returns(true) |
| 82 | article.expects(:comment_paragraph_plugin_activated?).returns(true) | 82 | article.expects(:comment_paragraph_plugin_activated?).returns(true) |
| 83 | 83 | ||
| 84 | - assert_equal 'Deactivate Comments', plugin.article_extra_toolbar_buttons(article)[:title] | 84 | + assert_equal 'Deactivate Comments', plugin.article_extra_toolbar_buttons(article).first[:title] |
| 85 | + end | ||
| 86 | + | ||
| 87 | + should 'display export comments button when comment paragraph plugin is activated' do | ||
| 88 | + profile = fast_create(Profile) | ||
| 89 | + article = fast_create(Article, :profile_id => profile.id) | ||
| 90 | + article.expects(:comment_paragraph_plugin_enabled?).returns(true) | ||
| 91 | + article.expects(:allow_edit?).with(user).returns(true) | ||
| 92 | + article.expects(:comment_paragraph_plugin_activated?).returns(false) | ||
| 93 | + | ||
| 94 | + assert_equal 'Export Comments', plugin.article_extra_toolbar_buttons(article).last[:title] | ||
| 85 | end | 95 | end |
| 86 | 96 | ||
| 87 | end | 97 | end |