Sha256: 6e9194b90d465385a268197aa8015ad147919ceb4d848392f10c84db3bd06893

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'matchy'
require 'mocha'
require 'fakeweb'

FakeWeb.allow_net_connect = false

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'billboard'

class Test::Unit::TestCase
end

def fixture_file(filename)
  return '' if filename == ''
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
  File.read(file_path)
end

def billboard_url(url)
  url =~ /^http/ ? url : "http://api.billboard.com:80/apisvc/chart/v1#{url}"
end

def stub_get(url, filename, status=nil)
  options = {:body => fixture_file(filename)}
  options.merge!({:status => status}) unless status.nil?
  
  FakeWeb.register_uri(:get, billboard_url(url), options)
end

def stub_post(url, filename)
  FakeWeb.register_uri(:post, billboard_url(url), :body => fixture_file(filename))
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
billboard-0.1.0 test/test_helper.rb