Sha256: cf04c8c9d03330f18356f1cdf459b5a353b4f7fe69e1aee3766523c38a29e3ae

Contents?: true

Size: 1.38 KB

Versions: 9

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe BaseCRM::SourcesService do
  describe 'Responds to' do
    subject { client.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.sources.all()).to be_instance_of BaseCRM::PaginatedResource
    end
  end

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

  describe :create do
    it "returns instance of Source class" do
      @source = build(:source)
      expect(client.sources.create(@source)).to be_instance_of BaseCRM::Source
    end
  end

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

    it "returns an instance of Source class" do
      expect(client.sources.find(@source.id)).to be_instance_of BaseCRM::Source
    end
  end

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

  describe :destroy do
    it "returns true on success" do
      @source = create(:source)
      expect(client.sources.destroy(@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/sources_service_spec.rb
basecrm-1.3.10 spec/services/sources_service_spec.rb
basecrm-1.3.9 spec/services/sources_service_spec.rb
basecrm-1.3.8 spec/services/sources_service_spec.rb
basecrm-1.3.7 spec/services/sources_service_spec.rb
basecrm-1.3.6 spec/services/sources_service_spec.rb
basecrm-1.3.5 spec/services/sources_service_spec.rb
basecrm-1.3.4 spec/services/sources_service_spec.rb
basecrm-1.3.3 spec/services/sources_service_spec.rb