Sha256: dffd7b542448154ab9ca8f1697a7e4e069cd0f68af3ed24b8840cce7ddd663b8

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

require 'test_helper'

module StringHelper
  def pick; "plong"; end
end

class DrummerCell < Cell::Base
  helper StringHelper
          
  def assist
    render :inline => "<%= pick %>"
  end
end


class HelperTest < ActionController::TestCase
  include Cell::TestCase::TestMethods
  
  context "a cell view" do
    should "have access to all helpers" do
      BassistCell.class_eval do
        def assist
          render :inline => "<%= submit_tag %>"
        end
      end
      
      assert_equal "<input name=\"commit\" type=\"submit\" value=\"Save changes\" />", render_cell(:bassist, :assist)
    end
    
    should "have access to methods declared with helper_method" do
      BassistCell.class_eval do
        def help; "Great!"; end
        helper_method :help
          
        def assist
          render :inline => "<%= help %>"
        end
      end
      
      assert_equal "Great!", render_cell(:bassist, :assist)
    end
    
    should "have access to methods provided by helper" do
      assert_equal "plong", render_cell(:drummer, :assist)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cells-3.6.2 test/helper_test.rb
cells-3.6.1 test/helper_test.rb
cells-3.6.0 test/helper_test.rb
cells-3.5.6 test/helper_test.rb
cells-3.5.5 test/helper_test.rb
cells-3.5.4 test/helper_test.rb
cells-3.5.2 test/helper_test.rb
cells-3.5.1 test/helper_test.rb
cells-3.5.0 test/helper_test.rb
cells-3.5.0.beta2 test/helper_test.rb
cells-3.5.0.beta1 test/helper_test.rb
cells-3.4.4 test/helper_test.rb
cells-3.4.3 test/helper_test.rb
cells-3.4.2 test/helper_test.rb
cells-3.4.1 test/helper_test.rb