Sha256: ffd7b9ce974662532f3a3d8cfc98b27e9425a9c250410014ecbc0338dde4b282
Contents?: true
Size: 788 Bytes
Versions: 7
Compression:
Stored size: 788 Bytes
Contents
$LOAD_PATH.unshift(File.expand_path("../..", __FILE__)) require "simplecov" SimpleCov.start do add_filter "spec/" add_filter ".bundle" end require "goodreads" require "webmock" require "webmock/rspec" def stub_get(path, params, fixture_name) params[:format] = "xml" stub_request(:get, api_url(path)) .with(query: params) .to_return( status: 200, body: fixture(fixture_name) ) end def stub_with_key_get(path, params, fixture_name) params[:key] = "SECRET_KEY" stub_get(path, params, fixture_name) end def fixture_path(file = nil) path = File.expand_path("../fixtures", __FILE__) file.nil? ? path : File.join(path, file) end def fixture(file) File.read(fixture_path(file)) end def api_url(path) "#{Goodreads::Request::API_URL}#{path}" end
Version data entries
7 entries across 7 versions & 1 rubygems