Sha256: ad09971a454feeeb03d806e8f0e81537a81424d7106a9cd3e288413acee02880

Contents?: true

Size: 1.5 KB

Versions: 9

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe BaseCRM::DealSourcesService do
  describe 'Responds to' do
    subject { client.deal_sources  }

    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.deal_sources.all()).to be_instance_of BaseCRM::PaginatedResource
    end
  end

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

  describe :create do
    it "returns instance of DealSource class" do
      @deal_source = build(:deal_source)
      expect(client.deal_sources.create(@deal_source)).to be_instance_of BaseCRM::DealSource
    end
  end

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

    it "returns an instance of DealSource class" do
      expect(client.deal_sources.find(@deal_source.id)).to be_instance_of BaseCRM::DealSource
    end
  end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
basecrm-2.0.0 spec/services/deal_sources_service_spec.rb
basecrm-1.3.10 spec/services/deal_sources_service_spec.rb
basecrm-1.3.9 spec/services/deal_sources_service_spec.rb
basecrm-1.3.8 spec/services/deal_sources_service_spec.rb
basecrm-1.3.7 spec/services/deal_sources_service_spec.rb
basecrm-1.3.6 spec/services/deal_sources_service_spec.rb
basecrm-1.3.5 spec/services/deal_sources_service_spec.rb
basecrm-1.3.4 spec/services/deal_sources_service_spec.rb
basecrm-1.3.3 spec/services/deal_sources_service_spec.rb