Skip to content
This repository
Browse code

! Fix padrino adapter to output proper unescaped HTML

  • Loading branch information...
commit 6acabf878b2b54c3f2572c7b05a05ee10ab57a9d 1 parent 9191bcd
Andi Schacke authored April 10, 2013
4  CHANGELOG
... ...
@@ -1,3 +1,7 @@
  1
+*3.10.1
  2
+
  3
+* Padrino adapter now returns "html_safe"d content_tag
  4
+
1 5
 *3.10.0
2 6
 
3 7
 * Added ability to set selected_class on container level. Credits to Joost Hietbrink.
4  lib/simple_navigation/adapters/padrino.rb
@@ -8,11 +8,11 @@ def self.register
8 8
       end
9 9
             
10 10
       def link_to(name, url, options={})
11  
-        context.link_to name, url, options
  11
+        context.link_to(name, url, options)
12 12
       end
13 13
       
14 14
       def content_tag(type, content, options={})
15  
-        context.content_tag type, content, options
  15
+        context.content_tag(type, content.html_safe, options)
16 16
       end
17 17
       
18 18
     end
4  spec/lib/simple_navigation/adapters/padrino_spec.rb
@@ -8,6 +8,7 @@ def create_adapter
8 8
   
9 9
   before(:each) do
10 10
     @request = stub(:request)
  11
+    @content = stub(:content)
11 12
     @context = stub(:context, :request => @request)
12 13
     @adapter = create_adapter
13 14
   end
@@ -21,8 +22,9 @@ def create_adapter
21 22
   
22 23
   describe 'content_tag' do
23 24
     it "should delegate to context" do
  25
+      @content.should_receive(:html_safe).and_return('content')
24 26
       @context.should_receive(:content_tag).with('type', 'content', :my_option => true)
25  
-      @adapter.content_tag('type', 'content', :my_option => true)
  27
+      @adapter.content_tag('type', @content, :my_option => true)
26 28
     end
27 29
   end
28 30
   

0 notes on commit 6acabf8

Please sign in to comment.
Something went wrong with that request. Please try again.