diff --git a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb index ad6cc22..573c7d7 100644 --- a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb +++ b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb @@ -11,7 +11,7 @@ class ContentViewerControllerTest < ActionController::TestCase def setup @profile = fast_create(Community) - @page = fast_create(Article, :profile_id => @profile.id, :body => "
") + @page = fast_create(Article, :profile_id => @profile.id, :body => "
") @environment = Environment.default @environment.enable_plugin(CommentParagraphPlugin) end @@ -19,10 +19,9 @@ class ContentViewerControllerTest < ActionController::TestCase attr_reader :page should 'parse article body and render comment paragraph view' do - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => page.id) + comment1 = fast_create(Comment, :paragraph_id => 0, :source_id => page.id) get :view_page, @page.url - assert_tag 'div', :attributes => {:class => 'comment_paragraph_1'} - assert_tag 'div', :attributes => {:id => 'comments_paragraph_count_1'} + assert_tag 'div', :attributes => {:class => 'comment_paragraph'} end end diff --git a/plugins/comment_paragraph/test/unit/article_test.rb b/plugins/comment_paragraph/test/unit/article_test.rb index b62af14..3f77cf1 100644 --- a/plugins/comment_paragraph/test/unit/article_test.rb +++ b/plugins/comment_paragraph/test/unit/article_test.rb @@ -16,41 +16,11 @@ class ArticleTest < ActiveSupport::TestCase assert_equal [comment1], article.paragraph_comments end - should 'do not allow a exclusion of a paragraph comment macro if this paragraph has comments' do - article.body = "
" - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) - assert !article.save - assert_equal ['Not empty paragraph comment cannot be removed'], article.errors[:base] - end - should 'allow save if comment paragraph macro is not removed for paragraph with comments' do - article.body = "
" - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) - assert article.save - end - - should 'do not validate empty paragraph if article body is not changed' do - article.body = "
" - assert article.save - comment1 = fast_create(Comment, :paragraph_id => 1, :source_id => article.id) - article.name = article.name + 'changed' + article.body = "
" + comment1 = fast_create(Comment, :paragraph_id => 0, :source_id => article.id) assert article.save end - should 'improve performance checking changes in body' do - i = 1 - time0 = (Benchmark.measure { 50.times { - i = i + 1 - article.body = "i = #{i}" - assert article.save - }}) - i = 1 - time1 = (Benchmark.measure { 50.times { - i = i + 1 - article.body = "i = 1" - assert article.save - }}) - assert time0.total > time1.total - end end diff --git a/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb b/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb index 4562b73..7700920 100644 --- a/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb +++ b/plugins/comment_paragraph/test/unit/comment_paragraph_plugin_test.rb @@ -25,36 +25,4 @@ class CommentParagraphPluginTest < ActiveSupport::TestCase assert plugin.stylesheet? end - should 'have extra contents for comment form' do - comment = fast_create(Comment, :paragraph_id => 1) - content = plugin.comment_form_extra_contents({:comment => comment}) - expects(:hidden_field_tag).with('comment[paragraph_id]', comment.paragraph_id).once - instance_eval(&content) - end - - should 'do not have extra contents for comments without paragraph' do - comment = fast_create(Comment, :paragraph_id => nil) - content = plugin.comment_form_extra_contents({:comment => comment}) - assert_equal nil, instance_eval(&content) - end - - should 'call without_paragraph for scope passed as parameter to unavailable_comments' do - article = fast_create(Article) - article.expects(:without_paragraph).once - plugin.unavailable_comments(article) - end - -#FIXME Obsolete test -# -# should 'filter_comments returns all the comments wihout paragraph of an article passed as parameter' do -# article = fast_create(Article) -# c1 = fast_create(Comment, :source_id => article.id, :paragraph_id => 1) -# c2 = fast_create(Comment, :source_id => article.id) -# c3 = fast_create(Comment, :source_id => article.id) -# -# plugin = CommentParagraphPlugin.new -# assert_equal [], [c2, c3] - plugin.filter_comments(article.comments) -# assert_equal [], plugin.filter_comments(article.comments) - [c2, c3] -# end - end -- libgit2 0.21.2