Sha256: dcf2d7429ce4142c06885ad476861bc1f2d32555da7e4ab0f93ac655ecce7eec

Contents?: true

Size: 1.5 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
basecrm-1.3.2 spec/services/deal_sources_service_spec.rb
basecrm-1.3.1 spec/services/deal_sources_service_spec.rb
basecrm-1.3.0 spec/services/deal_sources_service_spec.rb