ref: master
plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
require_relative '../test_helper' class ContentViewerController append_view_path File.join(File.dirname(__FILE__) + '/../../views') def rescue_action(e) raise e end end class ContentViewerControllerTest < ActionController::TestCase def setup @environment = Environment.default @environment.enable_plugin(CommentParagraphPlugin) @profile = fast_create(Community) @page = fast_create(TextArticle, :profile_id => @profile.id, :body => "<p>inner text</p>") @page.comment_paragraph_plugin_activate = true @page.save! end attr_reader :page should 'parse article body and render comment paragraph view' do comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id) get :view_page, @page.url assert_tag 'div', :attributes => {:class => 'comment_paragraph'} end should 'parse article body with correct html escape' do comment1 = fast_create(Comment, :paragraph_uuid => 0, :source_id => page.id) @page.body='<p><strong>inner text</strong></p>' @page.save get :view_page, @page.url assert_tag 'div', :content => 'inner text', :attributes => {:class => 'comment_paragraph'} end end |