Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8803: filter_in_the_wrong_place_failing_test_case.diff

File filter_in_the_wrong_place_failing_test_case.diff, 1.2 kB (added by nik.wakelin, 2 years ago)

Diff of a failing test case

  • filters_test.rb

    old new  
    349349      raise exception 
    350350    end 
    351351  end 
     352   
     353  class NonYieldingAroundFilterController < ActionController::Base 
    352354 
     355    before_filter :filter_one 
     356    around_filter :yielding_filter 
     357    before_filter :filter_two 
     358 
     359    def index 
     360      render :inline => "index" 
     361    end 
     362     
     363    #make sure the controller complains 
     364    def rescue_action(e); raise e; end 
     365 
     366    private 
     367 
     368      def filter_one 
     369        @filters  ||= [] 
     370        @filters  << "filter_one" 
     371      end 
     372 
     373      def filter_two 
     374        @filters  ||= [] 
     375        @filters  << "filter_two" 
     376      end 
     377 
     378      def yielding_filter 
     379        @filters  ||= [] 
     380        @filters  << "zomg it didn't yield" 
     381      end 
     382 
     383  end 
     384   
     385  def test_non_yielding_around_filters 
     386    controller = NonYieldingAroundFilterController.new 
     387    assert_nothing_raised do 
     388      test_process(controller, "index") 
     389    end 
     390  end 
     391   
     392 
    353393  def test_empty_filter_chain 
    354394    assert_equal 0, EmptyFilterChainController.filter_chain.size 
    355395    assert test_process(EmptyFilterChainController).template.assigns['action_executed']