Sha256: 3a1ad163efdd6b5616152dc9586274bf6253806f76d9b83990f9ff477e56e2b2

Contents?: true

Size: 964 Bytes

Versions: 4

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'

describe Moysklad::Resources::Base do
  it 'should be loaded' do
    expect(Moysklad::Resources::Base).to be_a Class
  end

  describe 'правильно определяет название модели' do
    let!(:entity_class) { Moysklad::Entities::Computer = Class.new }
    subject { Moysklad::Resources::Computers = Class.new Moysklad::Resources::Base }

    it do
      expect(subject.entity_class).to eq entity_class
    end
  end

  describe 'page' do
    let(:resource) { Moysklad::Resources::Features.new client: client }

    before do
      stub_rest :Feature
    end

    subject { resource.page }

    it do
      expect(subject).to be_a Moysklad::Entities::Page
      expect(subject.total).to eq feature_list_items_count
      expect(subject.count).to eq Moysklad::Entities::Collection::DEFAULT_COUNT
      expect(subject.start).to eq 0
      expect(subject.items.count).to eq feature_list_items_count
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moysklad-0.2.0 spec/lib/moysklad/resources/base_spec.rb
moysklad-0.1.5 spec/lib/moysklad/resources/base_spec.rb
moysklad-0.1.4 spec/lib/moysklad/resources/base_spec.rb
moysklad-0.1.3 spec/lib/moysklad/resources/base_spec.rb