Sha256: 1b4a7da060eaffa155df3ac552bc5569a55f663a5c87621e9f86400cc77c48e9

Contents?: true

Size: 936 Bytes

Versions: 23

Compression:

Stored size: 936 Bytes

Contents

def fixture_file(filename)
  return '' if filename == ''
  file_path = File.join(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, url, options)
end

def stub_post(url, filename, status=nil)
  options = {:body => fixture_file(filename)}
  options.merge!({:status => status}) unless status.nil?

  FakeWeb.register_uri(:post, url, options)
end

def stub_put(url, filename, status=nil)
  options = {:body => fixture_file(filename)}
  options.merge!({:status => status}) unless status.nil?

  FakeWeb.register_uri(:put, url, options)
end

def stub_delete(url, filename, status=nil)
  options = {:body => fixture_file(filename)}
  options.merge!({:status => status}) unless status.nil?

  FakeWeb.register_uri(:delete, url, options)
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
curdbee-0.0.10 spec/support/fakeweb_stubs.rb
stefl-chargify-0.3.10 spec/support/fakeweb_stubs.rb
curdbee-0.0.9 spec/support/fakeweb_stubs.rb
stefl-chargify-0.3.6 spec/support/fakeweb_stubs.rb
stefl-chargify-0.3.5 spec/support/fakeweb_stubs.rb
stefl-chargify-0.3.4 spec/support/fakeweb_stubs.rb
curdbee-0.0.8 spec/support/fakeweb_stubs.rb
curdbee-0.0.7 spec/support/fakeweb_stubs.rb
curdbee-0.0.6 spec/support/fakeweb_stubs.rb
curdbee-0.0.5 spec/support/fakeweb_stubs.rb
stefl-chargify-0.3.3 spec/support/fakeweb_stubs.rb
curdbee-0.0.4 spec/support/fakeweb_stubs.rb
curdbee-0.0.3 spec/support/fakeweb_stubs.rb
curdbee-0.0.2 spec/support/fakeweb_stubs.rb
jsmestad-chargify-0.3.3 spec/support/fakeweb_stubs.rb
curdbee-0.0.1 spec/support/fakeweb_stubs.rb
jsmestad-chargify-0.3.2.2 spec/support/fakeweb_stubs.rb
jsmestad-chargify-0.3.2.1 spec/support/fakeweb_stubs.rb
jsmestad-chargify-0.3.2 spec/support/fakeweb_stubs.rb
jsmestad-chargify-0.3.1 spec/support/fakeweb_stubs.rb