aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/console_app_test.rb
blob: cbaf2305945343ced37a0e5a380e8b0bd9db52a2 (plain) (tree)
1
2
3
4
5
6
7
8
9
                       


                                                                              

                                                           
                                            

   






                                                                                               


                                                     
 



                                                        
 
             
 



                       

     
require 'abstract_unit'

require 'action_controller' # console_app uses 'action_controller/integration'

unless defined? ApplicationController
  class ApplicationController < ActionController::Base; end
  ActionController::Base.session_store = nil
end

require 'dispatcher'
require 'console_app'

# console_app sets Test::Unit.run to work around the at_exit hook in test/unit, which kills IRB
Test::Unit.run = false

class ConsoleAppTest < Test::Unit::TestCase
  uses_mocha 'console reload test' do
    def test_reload_should_fire_preparation_callbacks
      a = b = c = nil

      Dispatcher.to_prepare { a = b = c = 1 }
      Dispatcher.to_prepare { b = c = 2 }
      Dispatcher.to_prepare { c = 3 }
      ActionController::Routing::Routes.expects(:reload)

      reload!

      assert_equal 1, a
      assert_equal 2, b
      assert_equal 3, c
    end
  end
end