lib/exception_handling/testing.rb in exception_handling-2.2.1 vs lib/exception_handling/testing.rb in exception_handling-2.3.0.pre.1

- old
+ new

@@ -1,65 +1,67 @@ +# frozen_string_literal: true # some useful test objects module ExceptionHandling module Testing class ControllerStub class Request attr_accessor :parameters, :protocol, :host, :request_uri, :env, :session_options + def initialize - @parameters = {:id => "1"} + @parameters = { id: "1" } @protocol = 'http' @host = 'localhost' @request_uri = "/fun/testing.html?foo=bar" - @env = {:HOST => "local"} - @session_options = { :id => '93951506217301' } + @env = { HOST: "local" } + @session_options = { id: '93951506217301' } end end attr_accessor :request, :session + class << self attr_accessor :around_filter_method + + def around_filter(method) + ControllerStub.around_filter_method = method + end end def initialize @request = Request.new @session_id = "ZKL95" @session = - if defined?(Username) - { - :login_count => 22, - :username_id => Username.first.id, - :user_id => User.first.id, - } - else - { } - end + if defined?(Username) + { + login_count: 22, + username_id: Username.first.id, + user_id: User.first.id, + } + else + {} + end end - def simulate_around_filter( &block ) - set_current_controller( &block ) + def simulate_around_filter(&block) + set_current_controller(&block) end def controller_name "ControllerStub" end def action_name "test_action" end - def self.around_filter( method ) - ControllerStub.around_filter_method = method - end - def complete_request_uri "#{@request.protocol}#{@request.host}#{@request.request_uri}" end include ExceptionHandling::Methods set_long_controller_action_timeout 2 end - end end