Commit e1163b1c7be7bc97a04f3529423c1e9b913b52aa

Authored by Braulio Bhavamitra
2 parents 8b0cf64a ffc2b613

Merge branch 'refactor_site_tour' into 'master'

Remove TourBlock#content

This method was in violation of MVC principles and its logic is now
handled by the BoxesHelper.

See merge request !907
plugins/site_tour/lib/site_tour_plugin/tour_block.rb
... ... @@ -19,11 +19,4 @@ class SiteTourPlugin::TourBlock < Block
19 19 _('Configure a step-by-step tour.')
20 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 22 end
... ...
plugins/site_tour/test/unit/tour_block_test.rb
... ... @@ -3,6 +3,7 @@ require 'test_helper'
3 3 class TrackListBlockTest < ActionView::TestCase
4 4  
5 5 ActionView::Base.send :include, ApplicationHelper
  6 + include BoxesHelper
6 7  
7 8 def setup
8 9 @block = fast_create(SiteTourPlugin::TourBlock)
... ... @@ -18,24 +19,24 @@ class TrackListBlockTest &lt; ActionView::TestCase
18 19  
19 20 should 'render script tag in visualization mode' do
20 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 23 end
23 24  
24 25 should 'do not render script tag when editing' do
25 26 controller.expects(:boxes_editor?).returns(true)
26 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 29 end
29 30  
30 31 should 'display help button' do
31 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 34 end
34 35  
35 36 should 'do not display help button when display_button is false' do
36 37 block.display_button = false
37 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 40 end
40 41  
41 42 end
... ...