Sha256: 992c5db0903e4319e5182ea1f1bdf4831a45f702e71ee6406134dbf73b9b7807

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require File.join(File.dirname(__FILE__), *%w[.. test_helper])
 
class ViewMethodsTest < ActionController::TestCase
  context "A Rails controller view" do
    setup do
      @controller = ApotomoController.new
      @controller.extend Apotomo::Rails::ControllerMethods
      @controller.session = {}
      
      @controller.instance_variable_set(:@mum, mouse_mock('mum', 'snuggle') {def snuggle; render; end})
      @controller.instance_eval do
        def widget
          use_widgets do |root|
            root << @mum
          end
          render :inline => "<%= render_widget 'mum' %>"
        end
      end
    end
    
    should "respond to render_widget" do
      get :widget
      assert_select "#mum>snuggle"
    end
    
    should "respond to url_for_event" do
      @controller.instance_eval do
        def widget
          use_widgets do |root|
            root << @mum
          end
          render :inline => "<%= url_for_event :footsteps, :source => 'mum' %>"
        end
      end
      
      get :widget
      assert_equal "/apotomo/render_event_response?source=mum&type=footsteps", @response.body
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apotomo-0.1.2 test/rails/view_methods_test.rb
apotomo-0.1.1 test/rails/view_methods_test.rb