Sha256: 12d2f0edbb2e3d4913c287a0c315d3cee534929fae8085a05b02d3206acf9d49

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

describe BaseCRM::AssociatedContactsService do
  describe 'Responds to' do
    subject { client.associated_contacts  }

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

  describe :all do
    it "returns a PaginatedResource" do
      deal_id = create(:deal).id
      expect(client.associated_contacts.all(deal_id)).to be_instance_of BaseCRM::PaginatedResource
    end
  end

  describe :where do
    it "returns an array" do
      deal_id = create(:deal).id
      expect(client.associated_contacts.where(deal_id, page: 1)).to be_an Array
    end
  end

  describe :create do
    it "returns instance of AssociatedContact class" do
      deal_id = create(:deal).id
      @associated_contact = build(:associated_contact)
      expect(client.associated_contacts.create(deal_id, @associated_contact)).to be_instance_of BaseCRM::AssociatedContact
    end
  end

  describe :destroy do
    it "returns true on success" do
      deal_id = create(:deal).id
      @associated_contact = create(:associated_contact, deal_id: deal_id)
      expect(client.associated_contacts.destroy(deal_id, @associated_contact.contact_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/associated_contacts_service_spec.rb
basecrm-1.3.10 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.9 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.8 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.7 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.6 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.5 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.4 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.3 spec/services/associated_contacts_service_spec.rb