Sha256: 5d3c5d0adae4d41112880d3734876eb6c203e67c33a88b0db5b6678516169b45

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

require '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.4 test/rails/view_methods_test.rb
apotomo-0.1.3 test/rails/view_methods_test.rb