Commit ffc2b613ac1e2ed6447a262434807e7ec5ff8271

Authored by Rafael Reggiani Manzo
1 parent 141c0c41

Remove TourBlock#content

This method was in violation of MVC principles and its logic is now
handled by the BoxesHelper.
plugins/site_tour/lib/site_tour_plugin/tour_block.rb
@@ -19,11 +19,4 @@ class SiteTourPlugin::TourBlock < Block @@ -19,11 +19,4 @@ class SiteTourPlugin::TourBlock < Block
19 _('Configure a step-by-step tour.') 19 _('Configure a step-by-step tour.')
20 end 20 end
21 21
22 - def content(args={})  
23 - block = self  
24 - proc do  
25 - render :file => 'blocks/tour', :locals => {:block => block}  
26 - end  
27 - end  
28 -  
29 end 22 end
plugins/site_tour/test/unit/tour_block_test.rb
@@ -3,6 +3,7 @@ require 'test_helper' @@ -3,6 +3,7 @@ require 'test_helper'
3 class TrackListBlockTest < ActionView::TestCase 3 class TrackListBlockTest < ActionView::TestCase
4 4
5 ActionView::Base.send :include, ApplicationHelper 5 ActionView::Base.send :include, ApplicationHelper
  6 + include BoxesHelper
6 7
7 def setup 8 def setup
8 @block = fast_create(SiteTourPlugin::TourBlock) 9 @block = fast_create(SiteTourPlugin::TourBlock)
@@ -18,24 +19,24 @@ class TrackListBlockTest &lt; ActionView::TestCase @@ -18,24 +19,24 @@ class TrackListBlockTest &lt; ActionView::TestCase
18 19
19 should 'render script tag in visualization mode' do 20 should 'render script tag in visualization mode' do
20 controller.expects(:boxes_editor?).returns(false) 21 controller.expects(:boxes_editor?).returns(false)
21 - assert_tag_in_string instance_eval(&block.content), :tag => 'script' 22 + assert_tag_in_string render_block_content(block), :tag => 'script'
22 end 23 end
23 24
24 should 'do not render script tag when editing' do 25 should 'do not render script tag when editing' do
25 controller.expects(:boxes_editor?).returns(true) 26 controller.expects(:boxes_editor?).returns(true)
26 controller.expects(:uses_design_blocks?).returns(true) 27 controller.expects(:uses_design_blocks?).returns(true)
27 - assert_no_tag_in_string instance_eval(&block.content), :tag => 'script' 28 + assert_no_tag_in_string render_block_content(block), :tag => 'script'
28 end 29 end
29 30
30 should 'display help button' do 31 should 'display help button' do
31 controller.expects(:boxes_editor?).returns(false) 32 controller.expects(:boxes_editor?).returns(false)
32 - assert_tag_in_string instance_eval(&block.content), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} 33 + assert_tag_in_string render_block_content(block), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'}
33 end 34 end
34 35
35 should 'do not display help button when display_button is false' do 36 should 'do not display help button when display_button is false' do
36 block.display_button = false 37 block.display_button = false
37 controller.expects(:boxes_editor?).returns(false) 38 controller.expects(:boxes_editor?).returns(false)
38 - assert_no_tag_in_string instance_eval(&block.content), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'} 39 + assert_no_tag_in_string render_block_content(block), :tag => 'a', :attributes => {:class => 'button icon-help with-text tour-button'}
39 end 40 end
40 41
41 end 42 end