Sha256: 662807846a25a79d20d09b315110697f202edb8a9eaaee2a1d3926acf86b1cb2

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe BaseCRM::DealsService do
  describe 'Responds to' do
    subject { client.deals  }

    it { should respond_to :all }
    it { should respond_to :create }
    it { should respond_to :destroy }
    it { should respond_to :find }
    it { should respond_to :update }
    it { should respond_to :where }
 
  end

  describe :all do
    it "returns a PaginatedResource" do
      expect(client.deals.all()).to be_instance_of BaseCRM::PaginatedResource
    end
  end

  describe :where do
    it "returns an array" do
      expect(client.deals.where(page: 1)).to be_an Array
    end
  end

  describe :create do
    it "returns instance of Deal class" do
      @deal = build(:deal)
      expect(client.deals.create(@deal)).to be_instance_of BaseCRM::Deal
    end
  end

  describe :find do
    before :each do
      @deal = create(:deal) 
    end

    it "returns an instance of Deal class" do
      expect(client.deals.find(@deal.id)).to be_instance_of BaseCRM::Deal
    end
  end

  describe :update do
    it "returns an updated instance of Deal class" do
      @deal = create(:deal)
      expect(client.deals.update(@deal)).to be_instance_of BaseCRM::Deal
    end
  end

  describe :destroy do
    it "returns true on success" do
      @deal = create(:deal)
      expect(client.deals.destroy(@deal.id)).to be_truthy
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
basecrm-1.2.0 spec/services/deals_service_spec.rb
basecrm-1.1.3 spec/services/deals_service_spec.rb
basecrm-1.1.2 spec/services/deals_service_spec.rb
basecrm-1.1.1 spec/services/deals_service_spec.rb
basecrm-1.1.0 spec/services/deals_service_spec.rb
basecrm-1.0.0 spec/services/deals_service_spec.rb