[Git][noosfero/noosfero][master] fix html safe erro in raw html block

Leandro Nunes gitlab at mg.gitlab.com
Thu May 12 10:09:10 BRT 2016


Leandro Nunes pushed to branch master at Noosfero / noosfero


Commits:
7b24dc08 by Leandro Nunes dos Santos at 2016-05-12T10:08:21-03:00
fix html safe erro in raw html block

- - - - -


2 changed files:

- app/views/blocks/raw_html.html.erb
- test/unit/raw_html_block_test.rb


Changes:

=====================================
app/views/blocks/raw_html.html.erb
=====================================
--- a/app/views/blocks/raw_html.html.erb
+++ b/app/views/blocks/raw_html.html.erb
@@ -1,3 +1,3 @@
 <%= block_title(block.title, block.subtitle) %>
 
-<%= block.html.html_safe %>
+<%= (block.html || '').html_safe %>


=====================================
test/unit/raw_html_block_test.rb
=====================================
--- a/test/unit/raw_html_block_test.rb
+++ b/test/unit/raw_html_block_test.rb
@@ -40,4 +40,11 @@ class RawHTMLBlockTest < ActiveSupport::TestCase
     assert block.editable?(user)
   end
 
+  should 'not raise if there is no html defined' do
+    block = RawHTMLBlock.new(:html => nil)
+    assert_nothing_raised do
+      render_block_content(block)
+    end
+  end
+
 end



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/7b24dc082212a6801699e0000e26562dc6ebb3c1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160512/73b528e5/attachment-0001.html>


More information about the Noosfero-dev mailing list