Methods
L
S
T
Included Modules
Instance Public methods
logs()
# File actionpack/test/controller/log_subscriber_test.rb, line 243
def logs
  @logs ||= @logger.logged(:info)
end
set_logger(logger)
# File actionpack/test/controller/log_subscriber_test.rb, line 86
def set_logger(logger)
  ActionController::Base.logger = logger
end
setup()
# File actionpack/test/controller/log_subscriber_test.rb, line 68
def setup
  super

  @old_logger = ActionController::Base.logger

  @cache_path = File.expand_path('../temp/test_cache', File.dirname(__FILE__))
  ActionController::Base.page_cache_directory = @cache_path
  @controller.cache_store = :file_store, @cache_path
  ActionController::LogSubscriber.attach_to :action_controller
end
teardown()
# File actionpack/test/controller/log_subscriber_test.rb, line 79
def teardown
  super
  ActiveSupport::LogSubscriber.log_subscribers.clear
  FileUtils.rm_rf(@cache_path)
  ActionController::Base.logger = @old_logger
end
test_halted_callback()
# File actionpack/test/controller/log_subscriber_test.rb, line 97
def test_halted_callback
  get :never_executed
  wait
  assert_equal 4, logs.size
  assert_equal "Filter chain halted as :redirector rendered or redirected", logs.third
end
test_process_action()
# File actionpack/test/controller/log_subscriber_test.rb, line 104
def test_process_action
  get :show
  wait
  assert_equal 2, logs.size
  assert_match(/Completed/, logs.last)
  assert_match(/200 OK/, logs.last)
end
test_process_action_with_exception_includes_http_status_code()
# File actionpack/test/controller/log_subscriber_test.rb, line 214
def test_process_action_with_exception_includes_http_status_code
  begin
    get :with_exception
    wait
  rescue Exception
  end
  assert_equal 2, logs.size
  assert_match(/Completed 500/, logs.last)
end
test_process_action_with_filter_parameters()
# File actionpack/test/controller/log_subscriber_test.rb, line 141
def test_process_action_with_filter_parameters
  @request.env["action_dispatch.parameter_filter"] = [:lifo, :amount]

  get :show, :lifo => 'Pratik', :amount => '420', :step => '1'
  wait

  params = logs[1]
  assert_match(/"amount"=>"\[FILTERED\]"/, params)
  assert_match(/"lifo"=>"\[FILTERED\]"/, params)
  assert_match(/"step"=>"1"/, params)
end
test_process_action_with_parameters()
# File actionpack/test/controller/log_subscriber_test.rb, line 118
def test_process_action_with_parameters
  get :show, :id => '10'
  wait

  assert_equal 3, logs.size
  assert_equal 'Parameters: {"id"=>"10"}', logs[1]
end
test_process_action_with_rescued_exception_includes_http_status_code()
# File actionpack/test/controller/log_subscriber_test.rb, line 224
def test_process_action_with_rescued_exception_includes_http_status_code
  get :with_rescued_exception
  wait

  assert_equal 2, logs.size
  assert_match(/Completed 406/, logs.last)
end
test_process_action_with_view_runtime()
# File actionpack/test/controller/log_subscriber_test.rb, line 135
def test_process_action_with_view_runtime
  get :show
  wait
  assert_match(/\(Views: [\d.]+ms\)/, logs[1])
end
test_process_action_with_with_action_not_found_logs_404()
# File actionpack/test/controller/log_subscriber_test.rb, line 232
def test_process_action_with_with_action_not_found_logs_404
  begin
    get :with_action_not_found
    wait
  rescue AbstractController::ActionNotFound
  end

  assert_equal 2, logs.size
  assert_match(/Completed 404/, logs.last)
end
test_process_action_with_wrapped_parameters()
# File actionpack/test/controller/log_subscriber_test.rb, line 126
def test_process_action_with_wrapped_parameters
  @request.env['CONTENT_TYPE'] = 'application/json'
  post :show, :id => '10', :name => 'jose'
  wait

  assert_equal 3, logs.size
  assert_match '"person"=>{"name"=>"jose"}', logs[1]
end
test_process_action_without_parameters()
# File actionpack/test/controller/log_subscriber_test.rb, line 112
def test_process_action_without_parameters
  get :show
  wait
  assert_nil logs.detect {|l| l =~ /Parameters/ }
end
test_redirect_to()
# File actionpack/test/controller/log_subscriber_test.rb, line 153
def test_redirect_to
  get :redirector
  wait

  assert_equal 3, logs.size
  assert_equal "Redirected to http://foo.bar/", logs[1]
end
test_send_data()
# File actionpack/test/controller/log_subscriber_test.rb, line 161
def test_send_data
  get :data_sender
  wait

  assert_equal 3, logs.size
  assert_match(/Sent data file\.txt/, logs[1])
end
test_send_file()
# File actionpack/test/controller/log_subscriber_test.rb, line 169
def test_send_file
  get :file_sender
  wait

  assert_equal 3, logs.size
  assert_match(/Sent file/, logs[1])
  assert_match(/test\/fixtures\/company\.rb/, logs[1])
end
test_start_processing()
# File actionpack/test/controller/log_subscriber_test.rb, line 90
def test_start_processing
  get :show
  wait
  assert_equal 2, logs.size
  assert_equal "Processing by Another::LogSubscribersController#show as HTML", logs.first
end
test_with_fragment_cache()
# File actionpack/test/controller/log_subscriber_test.rb, line 178
def test_with_fragment_cache
  @controller.config.perform_caching = true
  get :with_fragment_cache
  wait

  assert_equal 4, logs.size
  assert_match(/Read fragment views\/foo/, logs[1])
  assert_match(/Write fragment views\/foo/, logs[2])
ensure
  @controller.config.perform_caching = true
end
test_with_fragment_cache_and_percent_in_key()
# File actionpack/test/controller/log_subscriber_test.rb, line 190
def test_with_fragment_cache_and_percent_in_key
  @controller.config.perform_caching = true
  get :with_fragment_cache_and_percent_in_key
  wait

  assert_equal 4, logs.size
  assert_match(/Read fragment views\/foo/, logs[1])
  assert_match(/Write fragment views\/foo/, logs[2])
ensure
  @controller.config.perform_caching = true
end
test_with_page_cache()
# File actionpack/test/controller/log_subscriber_test.rb, line 202
def test_with_page_cache
  @controller.config.perform_caching = true
  get :with_page_cache
  wait

  assert_equal 3, logs.size
  assert_match(/Write page/, logs[1])
  assert_match(/\/index\.html/, logs[1])
ensure
  @controller.config.perform_caching = true
end