Sha256: 12169bbe150a3a1d58a720ae5e993faed0c8c99686d41c5bf849de5091663049

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 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 'shoppr'

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 remix_url(url)
  url =~ /^http/ ? url : "http://sandbox.api.shopping.com/publisher/3.0/rest#{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, remix_url(url), options)
end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoppr-0.2.3 test/test_helper.rb
shoppr-0.1.1 test/test_helper.rb
shoppr-0.1.0 test/test_helper.rb