Commit e9e5d31df4096abb8b4129ccd4f5466edf0c90c8

Authored by Victor Costa
1 parent 498b3078

html_safe: not escape tinymce macros

app/helpers/macros_helper.rb
... ... @@ -32,7 +32,7 @@ module MacrosHelper
32 32 }
33 33 });
34 34 }"
35   - end
  35 + end.html_safe
36 36 end
37 37  
38 38 def include_macro_js_files
... ...
test/integration/safe_strings_test.rb
... ... @@ -100,4 +100,21 @@ class SafeStringsTest < ActionDispatch::IntegrationTest
100 100 get url_for(article.view_url)
101 101 assert_select ".publishing-info .author a"
102 102 end
  103 +
  104 + should 'not escape tinymce macros when create article' do
  105 + class Plugin1 < Noosfero::Plugin
  106 + end
  107 + class Plugin1::Macro < Noosfero::Plugin::Macro
  108 + def self.configuration
  109 + {params: {}}
  110 + end
  111 + end
  112 + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([SafeStringsTest::Plugin1.new])
  113 +
  114 + create_user('jimi', :password => 'test', :password_confirmation => 'test').activate
  115 + person = Person['jimi']
  116 + login 'jimi', 'test'
  117 + get "/myprofile/jimi/cms/new?type=TinyMceArticle"
  118 + assert_no_match /title: &quot;Safestringstest::plugin1::macro&quot/, response.body
  119 + end
103 120 end
... ...