aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb
blob: 86555a77df1268d0c1fc3761b48d4878803f3188 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'abstract_unit'

class DeprecatedBaseMethodsTest < Test::Unit::TestCase
  class Target < ActionController::Base
    def home_url(greeting)
      "http://example.com/#{greeting}"
    end

    def raises_name_error
      this_method_doesnt_exist
    end

    def rescue_action(e) raise e end
  end

  def setup
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
    @controller = Target.new
  end

  def test_log_error_silences_deprecation_warnings
    get :raises_name_error
  rescue => e
    assert_not_deprecated { @controller.send :log_error, e }
  end

  def test_assertion_failed_error_silences_deprecation_warnings
    get :raises_name_error
  rescue => e
    error = Test::Unit::Error.new('testing ur doodz', e)
    assert_not_deprecated { error.message }
  end
end