File: test_missing_open_uri.rb

package info (click to toggle)
ruby-fakeweb 1.3.0%2Bgit20170806%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 436 kB
  • sloc: ruby: 2,057; sh: 24; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 583 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
require 'test_helper'

class TestMissingOpenURI < Test::Unit::TestCase

  def setup
    super
    @saved_open_uri = OpenURI
    Object.send(:remove_const, :OpenURI)
  end

  def teardown
    super
    Object.const_set(:OpenURI, @saved_open_uri)
  end


  def test_register_using_exception_without_open_uri
    # regression test for Responder needing OpenURI::HTTPError to be defined
    FakeWeb.register_uri(:get, "http://example.com/", :exception => StandardError)
    assert_raises(StandardError) do
      Net::HTTP.start("example.com") { |http| http.get("/") }
    end
  end

end