Sha256: 0c7b4d057b0f30f400f9ea1fdf6789dd18234207b8ebb98e1d0e1adf071f108c

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe BaseCRM::NotesService do
  describe 'Responds to' do
    subject { client.notes  }

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

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

  describe :create do
    it "returns instance of Note class" do
      @note = build(:note)
      expect(client.notes.create(@note)).to be_instance_of BaseCRM::Note
    end
  end

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

    it "returns an instance of Note class" do
      expect(client.notes.find(@note.id)).to be_instance_of BaseCRM::Note
    end
  end

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

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