Sha256: 2877d392a65c0235a4723887be9cb9c4096568bffb9614364e9be1add746f63f

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

class TestMissingPathname < Test::Unit::TestCase

  def setup
    super
    @saved_pathname = Pathname
    Object.send(:remove_const, :Pathname)
  end

  def teardown
    super
    Object.const_set(:Pathname, @saved_pathname)
  end

  # FakeWeb supports using Pathname objects where filenames are expected, but
  # Pathname isn't required to use FakeWeb. Make sure everything still works
  # when Pathname isn't in use.

  def test_register_using_body_without_pathname
    FakeWeb.register_uri(:get, "http://example.com/", :body => fixture_path("test_example.txt"))
    Net::HTTP.start("example.com") { |http| http.get("/") }
  end

  def test_register_using_response_without_pathname
    FakeWeb.register_uri(:get, "http://example.com/", :response => fixture_path("google_response_without_transfer_encoding"))
    Net::HTTP.start("example.com") { |http| http.get("/") }
  end

  def test_register_using_unsupported_response_without_pathname
    FakeWeb.register_uri(:get, "http://example.com/", :response => 1)
    assert_raise StandardError do
      Net::HTTP.start("example.com") { |http| http.get("/") }
    end
  end

end

Version data entries

8 entries across 8 versions & 5 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/test_missing_pathname.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/fakeweb-1.3.0/test/test_missing_pathname.rb
putio-0.0.1.pre2 development/ruby/1.8/gems/fakeweb-1.3.0/test/test_missing_pathname.rb
putio-0.0.1.pre development/ruby/1.8/gems/fakeweb-1.3.0/test/test_missing_pathname.rb
cotweet-fakeweb-1.3.0 test/test_missing_pathname.rb
fakeweb-1.3.0 test/test_missing_pathname.rb
corntrace-fakeweb-1.2.9 test/test_missing_pathname.rb
fakeweb-1.2.8 test/test_missing_pathname.rb