Repository URL to install this package:
|
Version:
0.0.1 ▾
|
require 'spec_helper'
RSpec.describe Razorsync::Client::Customers do
before do
@client = Razorsync::Client.new({token: "TestToken", portal_name: "TestPortal"})
end
describe '#customer_list' do
before do
stub_request(:post, "https://testportal.0.razorsync.com/ApiService.svc/Customer/List").
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length'=>'0', 'Content-Type'=>'application/json', 'Host'=>'TestPortal.0.razorsync.com', 'Servername'=>'TestPortal', 'Token'=>'TestToken', 'User-Agent'=>'Faraday v0.9.2'}).
to_return(:status => 200, :body => fixture('customers_list.json'))
end
it "should return a list of customers" do
@client.customer_list
expect(a_get(:post, "Customer/List", @client.portal_name)).to have_been_made
end
end
describe '#customer' do
before do
stub_request(:get, "https://testportal.0.razorsync.com/ApiService.svc/Customer/35").
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'TestPortal.0.razorsync.com', 'Servername'=>'TestPortal', 'Token'=>'TestToken', 'User-Agent'=>'Faraday v0.9.2'}).
to_return(:status => 200, :body => fixture('customers_list.json'))
end
it "should return a customer" do
@client.customer(35)
expect(a_get(:get, "Customer/35", @client.portal_name)).to have_been_made
end
end
end