Sha256: 863d13e8540d65d32ff32a7c7e8b18cc291166430921a59b408ce4bb4bfdbebd

Contents?: true

Size: 609 Bytes

Versions: 5

Compression:

Stored size: 609 Bytes

Contents

require 'fakeweb'

module FakewebHelper
  # Make sure nothing gets out (IMPORTANT)
  FakeWeb.allow_net_connect = false

  # Turns a fixture file name into a full path
  def fixture_file(filename)
    return '' if filename == ''
    "#{SimpleYoutube::ROOT}/spec/fixture/#{filename}"
  end

  # Convenience methods for stubbing URLs to fixtures
  def stub_get(url, filename)
    FakeWeb.register_uri(:get, url, :response => fixture_file(filename))
  end

  def stub_http_error(http_type, url, error_code, error_message)
    FakeWeb.register_uri(http_type, url, :status => [error_code, error_message])
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_youtube-4.0.4 spec/fakeweb_helper.rb
simple_youtube-4.0.3 spec/fakeweb_helper.rb
simple_youtube-4.0.2 spec/fakeweb_helper.rb
simple_youtube-4.0.1 spec/fakeweb_helper.rb
simple_youtube-3.0.1 spec/fakeweb_helper.rb