File: test_deprecations.rb

package info (click to toggle)
ruby-fakeweb 1.3.0%2Bgit20170806%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 380 kB
  • sloc: ruby: 2,057; sh: 24; makefile: 3
file content (54 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download | duplicates (6)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'test_helper'

class TestDeprecations < Test::Unit::TestCase

  def test_register_uri_without_method_argument_prints_deprecation_warning
    warning = capture_stderr do
      FakeWeb.register_uri("http://example.com", :body => "test")
    end
    assert_match %r(deprecation warning: fakeweb)i, warning
  end

  def test_registered_uri_without_method_argument_prints_deprecation_warning
    warning = capture_stderr do
      FakeWeb.registered_uri?("http://example.com")
    end
    assert_match %r(deprecation warning: fakeweb)i, warning
  end

  def test_response_for_without_method_argument_prints_deprecation_warning
    warning = capture_stderr do
      FakeWeb.response_for("http://example.com")
    end
    assert_match %r(deprecation warning: fakeweb)i, warning
  end

  def test_register_uri_without_method_argument_prints_deprecation_warning_with_correct_caller
    warning = capture_stderr do
      FakeWeb.register_uri("http://example.com", :body => "test")
    end
    assert_match %r(Called at.*?test_deprecations\.rb)i, warning
  end

  def test_register_uri_with_string_option_prints_deprecation_warning
    warning = capture_stderr do
      FakeWeb.register_uri(:get, "http://example.com", :string => "test")
    end
    assert_match %r(deprecation warning: fakeweb's :string option)i, warning
  end

  def test_register_uri_with_file_option_prints_deprecation_warning
    warning = capture_stderr do
      FakeWeb.register_uri(:get, "http://example.com", :file => fixture_path("test_example.txt"))
    end
    assert_match %r(deprecation warning: fakeweb's :file option)i, warning
  end

  def test_register_uri_with_string_option_prints_deprecation_warning_with_correct_caller
    warning = capture_stderr do
      FakeWeb.register_uri(:get, "http://example.com", :string => "test")
    end
    assert_match %r(Called at.*?test_deprecations\.rb)i, warning
  end

end