aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/mocks/dispatcher.rb
blob: 6561a1358136ef322e0afc5ebe118197a4cf32f5 (plain) (tree)
1
2
3
4
5
6
7
8



                                  
                                

                     
                                              




                                                                
class Dispatcher
  class <<self
    attr_accessor :time_to_sleep
    attr_accessor :raise_exception
    attr_accessor :dispatch_hook

    def dispatch(cgi)
      dispatch_hook.call(cgi) if dispatch_hook
      sleep(time_to_sleep || 0)
      raise raise_exception, "Something died" if raise_exception
    end
  end
end