Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
appointment_plus / spec / appointment_plus / clients / appointments_spec.rb
Size: Mime:
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 '#appointments' do
    before do
      stub_request(:post, "https://test-id:test-key@ws.appointment-plus.com/Appointments/GetAppointments?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 appointments" do
      @client.appointments

      expect(a_get(@client, "Appointments/GetAppointments?response_type=json")).to have_been_made
    end
  end


  describe '#appointment' do
    before do
      stub_request(:post, "https://test-id:test-key@ws.appointment-plus.com/Appointments/GetAppointments?appointment=138396&response_type=json").
         with(:body => "{\"response_type\":\"json\",\"appointment\":\"138396\"}",
              :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 appointment" do
      @client.appointment(138396)

      expect(a_get(@client, "Appointments/GetAppointments?response_type=json&appointment=138396")).to have_been_made
    end
  end

end