Sha256: 20efc1a388e297059044d4f64e66ed98622fa852901a4487b29fd7d086e61d43

Contents?: true

Size: 1.2 KB

Versions: 35

Compression:

Stored size: 1.2 KB

Contents

require "test/unit"
require "pathname"
require "shoulda"
require "matchy"
require "mocha"
require "fakeweb"
require "redgreen"

FakeWeb.allow_net_connect = false

dir = (Pathname(__FILE__).dirname + "../lib").expand_path
require dir + "mambanation"

class Test::Unit::TestCase
end

def sample_image(filename)
  File.expand_path(File.dirname(__FILE__) + "/fixtures/" + filename)
end

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

def mambanation_url(url)
  url =~ /^http/ ? url : "http://username:password@api.mambanation.com/v2/#{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, mambanation_url(url), options)
end

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

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

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

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
mambanation-0.2.2 test/test_helper.rb
mambanation-0.2.1 test/test_helper.rb
mambanation-0.1.32 test/test_helper.rb
mambanation-0.1.31 test/test_helper.rb
mambanation-0.1.30 test/test_helper.rb
mambanation-0.1.29 test/test_helper.rb
mambanation-0.1.28 test/test_helper.rb
mambanation-0.1.27 test/test_helper.rb
mambanation-0.1.26 test/test_helper.rb
mambanation-0.1.25 test/test_helper.rb
mambanation-0.1.24 test/test_helper.rb
mambanation-0.1.23 test/test_helper.rb
mambanation-0.1.22 test/test_helper.rb
mambanation-0.1.21 test/test_helper.rb
mambanation-0.1.20 test/test_helper.rb
mambanation-0.1.19 test/test_helper.rb
mambanation-0.1.18 test/test_helper.rb
mambanation-0.1.17 test/test_helper.rb
mambanation-0.1.16 test/test_helper.rb
mambanation-0.1.15 test/test_helper.rb