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    
razorsync / spec / razorsync / clients / work_orders_spec.rb
Size: Mime:
require 'spec_helper'

RSpec.describe Razorsync::Client::WorkOrders do
  before do
    @client = Razorsync::Client.new({token: "TestToken", portal_name: "TestPortal"})
  end

  describe '#work_order_list' do
    before do
      stub_request(:post, "https://testportal.0.razorsync.com/ApiService.svc/WorkOrder/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('work_orders_list.json'))
    end

    it "should return a list of work orders" do
      @client.work_order_list

      expect(a_get(:post, "WorkOrder/List", @client.portal_name)).to have_been_made
    end
  end

  describe '#work_order' do
    before do
      stub_request(:get, "https://testportal.0.razorsync.com/ApiService.svc/WorkOrder/2399").
        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('work_orders_list.json'))
    end

    it "should return a work order" do
      @client.work_order(2399)

      expect(a_get(:get, "WorkOrder/2399", @client.portal_name)).to have_been_made
    end
  end

end