Repository URL to install this package:
|
Version:
0.0.1 ▾
|
require 'spec_helper'
RSpec.describe AppointmentPlus::Client::Customers do
before do
@client = AppointmentPlus::Client.new({api_key: "test-key", site_id: "test-id"})
end
describe '#customers' do
before do
stub_request(:post, "https://test-id:test-key@ws.appointment-plus.com/Customers/GetCustomers?response_type=json").
with(:body => "{\"response_type\":\"json\"}",
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
to_return(:status => 200, :body => "", :headers => {})
end
it "should return a list of customers" do
@client.customers
expect(a_get(@client, "Customers/GetCustomers?response_type=json")).to have_been_made
end
end
describe '#customer' do
before do
stub_request(:post, "https://test-id:test-key@ws.appointment-plus.com/Customers/GetCustomers?customer=51990&response_type=json").
with(:body => "{\"response_type\":\"json\",\"customer\":\"51990\"}",
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
to_return(:status => 200, :body => "", :headers => {})
end
it "should return a customer" do
@client.customer(51990)
expect(a_get(@client, "Customers/GetCustomers?response_type=json&customer=51990")).to have_been_made
end
end
end