Sha256: ed71aaa917c745891c41c1b1d605613c25dcafe87acf50899f6dba1ca8078815

Contents?: true

Size: 1.24 KB

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
basecrm-1.3.2 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.1 spec/services/associated_contacts_service_spec.rb
basecrm-1.3.0 spec/services/associated_contacts_service_spec.rb
basecrm-1.2.3 spec/services/associated_contacts_service_spec.rb
basecrm-1.2.2 spec/services/associated_contacts_service_spec.rb
basecrm-1.2.1 spec/services/associated_contacts_service_spec.rb
basecrm-1.2.0 spec/services/associated_contacts_service_spec.rb
basecrm-1.1.3 spec/services/associated_contacts_service_spec.rb
basecrm-1.1.2 spec/services/associated_contacts_service_spec.rb
basecrm-1.1.1 spec/services/associated_contacts_service_spec.rb
basecrm-1.1.0 spec/services/associated_contacts_service_spec.rb
basecrm-1.0.0 spec/services/associated_contacts_service_spec.rb