Sha256: 25edcd2449475feb3ca00bbd4cc445db9d3f90e5aa68dd6ab36f62f74b5a9009

Contents?: true

Size: 1.67 KB

Versions: 8

Compression:

Stored size: 1.67 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

### DISCUSS: how can we limit that test to systems where ActiveHelper's around?

class ActiveHelperTest < ActiveSupport::TestCase
  context "The Cell::Base class" do
    setup do
      require 'active_helper'
      class FingeringHelper < ActiveHelper::Base
        provides :finger
      end
      
      class SlappingHelper < ActiveHelper::Base
        provides :slap
      end
    end
    
    should "respond to active_helper" do
      assert_respond_to Cell::Base, :active_helper
    end
    
    should "store helper constants from active_helper" do
      @cell = Class.new(BassistCell)
      @cell.active_helper SlappingHelper
      assert_equal [SlappingHelper], @cell.active_helpers
    end
    
    should "inherit helper constants from active_helper" do
      @base_cell = Class.new(BassistCell)
      @base_cell.active_helper SlappingHelper
      @cell = Class.new(@base_cell)
      @cell.active_helper FingeringHelper
      assert_equal [SlappingHelper, FingeringHelper], @cell.active_helpers
    end
    
    
    context "An Cell::View::Base instance" do
      should_eventually "respond to use" do
        # we didn't extend the view at this point.
        @view = bassist_mock.setup_action_view
        assert_respond_to @view, :use
      end
      
    end
    
    context "The view rendered by the cell" do
      should "respond to used helper methods" do
        @cell = bassist_mock
        @cell.class.active_helper SlappingHelper
        
        @view = @cell.setup_action_view
        @cell.prepare_action_view_for(@view, {})
        
        assert_respond_to @view, :slap # from the SlappingHelper
      end
    end
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cells-3.3.10 test/active_helper_test.rb
cells-3.3.9 test/active_helper_test.rb
cells-3.3.8 test/active_helper_test.rb
cells-3.3.7 test/active_helper_test.rb
cells-3.3.6 test/active_helper_test.rb
cells-3.3.5 test/active_helper_test.rb
cells-3.3.4 test/active_helper_test.rb
cells-3.3.3 test/active_helper_test.rb