Sha256: 8d0079629ae0ec8f9554cde28fe39faef4acf456c976ab8535e6322c39ec8573

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

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

FakeWeb.allow_net_connect = false


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

class Test::Unit::TestCase
end

def songkick_url(url)
  url =~ /^http/ ? url : "http://api.songkick.com/api/3.0#{url}"
end

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

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

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

def stub_put(url, filename)
  FakeWeb.register_uri(:put, songkick_url(url), :body => fixture_file(filename))
end

def stub_delete(url, filename)
  FakeWeb.register_uri(:delete, songkick_url(url), :body => fixture_file(filename))
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
songkickr-0.1.3 test/helper.rb
songkickr-0.1.2 test/helper.rb
songkickr-0.1.1 test/helper.rb
songkickr-0.1.0 test/helper.rb