moysklad 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/rspec.yml +29 -0
- data/lib/moysklad/client.rb +9 -4
- data/lib/moysklad/entities/assortment.rb +0 -2
- data/lib/moysklad/entities/attribute.rb +0 -3
- data/lib/moysklad/entities/attribute_metadata.rb +0 -2
- data/lib/moysklad/entities/attribute_value.rb +3 -4
- data/lib/moysklad/entities/characteristic.rb +0 -2
- data/lib/moysklad/entities/characteristic_metadata.rb +0 -2
- data/lib/moysklad/entities/collection.rb +0 -3
- data/lib/moysklad/entities/company_settings_metadata.rb +0 -2
- data/lib/moysklad/entities/consignment.rb +0 -3
- data/lib/moysklad/entities/context.rb +0 -2
- data/lib/moysklad/entities/counterparty.rb +4 -2
- data/lib/moysklad/entities/country.rb +2 -8
- data/lib/moysklad/entities/currency.rb +0 -2
- data/lib/moysklad/entities/custom_entity.rb +0 -3
- data/lib/moysklad/entities/customer_order.rb +0 -7
- data/lib/moysklad/entities/customer_order_position.rb +0 -4
- data/lib/moysklad/entities/employee.rb +0 -2
- data/lib/moysklad/entities/entity.rb +0 -3
- data/lib/moysklad/entities/group.rb +5 -2
- data/lib/moysklad/entities/image.rb +0 -1
- data/lib/moysklad/entities/meta.rb +0 -2
- data/lib/moysklad/entities/organization.rb +0 -2
- data/lib/moysklad/entities/price.rb +0 -1
- data/lib/moysklad/entities/price_type.rb +0 -2
- data/lib/moysklad/entities/product.rb +0 -7
- data/lib/moysklad/entities/productfolder.rb +0 -2
- data/lib/moysklad/entities/rate.rb +0 -3
- data/lib/moysklad/entities/resource_metadata.rb +0 -5
- data/lib/moysklad/entities/service.rb +5 -10
- data/lib/moysklad/entities/shortcut.rb +0 -2
- data/lib/moysklad/entities/store.rb +0 -1
- data/lib/moysklad/entities/uom.rb +0 -2
- data/lib/moysklad/entities/variant.rb +0 -4
- data/lib/moysklad/entities.rb +42 -35
- data/lib/moysklad/resources/assortments.rb +0 -1
- data/lib/moysklad/resources/base.rb +4 -3
- data/lib/moysklad/resources/custom_entities.rb +3 -1
- data/lib/moysklad/resources/custom_entity_metadata.rb +1 -1
- data/lib/moysklad/resources/embedded_entity_metadata.rb +2 -2
- data/lib/moysklad/resources/indexed.rb +1 -5
- data/lib/moysklad/resources/positions.rb +15 -0
- data/lib/moysklad/resources/stock.rb +1 -1
- data/lib/moysklad/resources/subresource.rb +0 -1
- data/lib/moysklad/resources.rb +22 -9
- data/lib/moysklad/universe.rb +1 -1
- data/lib/moysklad/version.rb +1 -1
- data/lib/moysklad.rb +11 -7
- data/moysklad.gemspec +2 -2
- data/spec/lib/moysklad/entities/customer_order_position_spec.rb +4 -17
- data/spec/lib/moysklad/entities/customer_order_spec.rb +7 -37
- data/spec/lib/moysklad/resources/base_spec.rb +0 -54
- data/spec/lib/moysklad/resources_spec.rb +0 -2
- data/spec/lib/moysklad/universe_spec.rb +0 -23
- data/spec/lib/moysklad_spec.rb +0 -1
- data/spec/support/resource.rb +1 -66
- metadata +10 -146
- data/.travis.yml +0 -5
- data/lib/moysklad/entities/attachment_document.rb +0 -16
- data/lib/moysklad/entities/barcode.rb +0 -19
- data/lib/moysklad/entities/common_object.rb +0 -27
- data/lib/moysklad/entities/company.rb +0 -20
- data/lib/moysklad/entities/company_concern.rb +0 -20
- data/lib/moysklad/entities/contact.rb +0 -15
- data/lib/moysklad/entities/custom_entity_metadata.rb +0 -11
- data/lib/moysklad/entities/embedded_entity_metadata.rb +0 -18
- data/lib/moysklad/entities/error.rb +0 -13
- data/lib/moysklad/entities/good_folder.rb +0 -10
- data/lib/moysklad/entities/good_ref.rb +0 -12
- data/lib/moysklad/entities/images.rb +0 -10
- data/lib/moysklad/entities/my_company.rb +0 -12
- data/lib/moysklad/entities/sale_price.rb +0 -18
- data/lib/moysklad/entities/sale_prices.rb +0 -10
- data/lib/moysklad/entities/slot.rb +0 -10
- data/lib/moysklad/entities/workflow.rb +0 -11
- data/lib/moysklad/entities/workflow_state.rb +0 -8
- data/spec/fixtures/302.raw +0 -15
- data/spec/fixtures/400.raw +0 -8
- data/spec/fixtures/401.html +0 -1
- data/spec/fixtures/401_2.html +0 -1
- data/spec/fixtures/405.raw +0 -9
- data/spec/fixtures/500.raw +0 -8
- data/spec/fixtures/502.raw +0 -8
- data/spec/fixtures/Consignment_list_0.raw +0 -14
- data/spec/fixtures/Consignment_list_1000.raw +0 -14
- data/spec/fixtures/Country_list.raw +0 -14
- data/spec/fixtures/CustomEntityMetadata_list.raw +0 -14
- data/spec/fixtures/CustomEntity_list.raw +0 -14
- data/spec/fixtures/CustomEntity_list_bad_chars.raw +0 -17
- data/spec/fixtures/EmbeddedEntityMetadata_list.raw +0 -15
- data/spec/fixtures/Feature_list.raw +0 -14
- data/spec/fixtures/Feature_list_1000.raw +0 -14
- data/spec/fixtures/Good_WithManyAttributes.raw +0 -13
- data/spec/fixtures/Good_e932ebe1-2e22-11e4-9406-002590a28eca.raw +0 -12
- data/spec/fixtures/Good_eb77ad57-2e22-11e4-4030-002590a28eca.raw +0 -12
- data/spec/fixtures/Goods_list.raw +0 -14
- data/spec/fixtures/Metadata_list.raw +0 -14
- data/spec/fixtures/PriceType_list.raw +0 -14
- data/spec/fixtures/Stock.raw +0 -11
- data/spec/fixtures/Stock_showConsignments.raw +0 -11
- data/spec/fixtures/Uom_list.raw +0 -14
- data/spec/fixtures/Warehouse_list.raw +0 -14
- data/spec/fixtures/Workflow_list.raw +0 -15
- data/spec/fixtures/attribute_boolean.xml +0 -6
- data/spec/fixtures/attribute_dictionary.xml +0 -5
- data/spec/fixtures/attribute_double.xml +0 -6
- data/spec/fixtures/attribute_file.xml +0 -12
- data/spec/fixtures/attribute_long.xml +0 -6
- data/spec/fixtures/attribute_text.xml +0 -5
- data/spec/fixtures/attribute_time.xml +0 -6
- data/spec/fixtures/attribute_url.xml +0 -6
- data/spec/fixtures/bad_chars.xml +0 -6
- data/spec/fixtures/customer_order.xml +0 -28
- data/spec/fixtures/good_with_attributes.raw +0 -12
- data/spec/fixtures/good_with_image.xml +0 -39
- data/spec/fixtures/resource_forbidden.raw +0 -9
- data/spec/fixtures/wrong_password.raw +0 -9
- data/spec/fixtures/wrong_type.raw +0 -70
- data/spec/fixtures/wrong_user.raw +0 -9
- data/spec/lib/moysklad/client/errors_spec.rb +0 -102
- data/spec/lib/moysklad/entities/attribute_metadata_spec.rb +0 -30
- data/spec/lib/moysklad/entities/attribute_spec.rb +0 -36
- data/spec/lib/moysklad/entities/country_spec.rb +0 -25
- data/spec/lib/moysklad/entities/custom_entity_metadata_spec.rb +0 -34
- data/spec/lib/moysklad/entities/custom_entity_spec.rb +0 -34
- data/spec/lib/moysklad/entities/good_spec.rb +0 -55
- data/spec/lib/moysklad/resources/countries_spec.rb +0 -22
- data/spec/lib/moysklad/resources/custom_entity_metadata_spec.rb +0 -13
- data/spec/lib/moysklad/resources/embedded_entity_metadata_indexed_spec.rb +0 -20
- data/spec/lib/moysklad/resources/embedded_entity_metadata_spec.rb +0 -11
- data/spec/lib/moysklad/resources/good_folders_spec.rb +0 -17
- data/spec/lib/moysklad/resources/indexed_spec.rb +0 -61
- data/spec/lib/moysklad/resources/stock_spec.rb +0 -63
- data/spec/lib/moysklad/resources/warehouses_spec.rb +0 -20
- data/spec/lib/moysklad/resources/workflows_spec.rb +0 -21
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::AttributeMetadata do
|
4
|
-
let(:metadata_resource) { Moysklad::Resources::EmbeddedEntityMetadata.indexed client: client }
|
5
|
-
let(:subresource) { metadata_resource.subresource_by_name :GoodFolder }
|
6
|
-
let(:attribute_metadata) { subresource.items.first }
|
7
|
-
|
8
|
-
before do
|
9
|
-
stub_rest :EmbeddedEntityMetadata, :list, 0
|
10
|
-
stub_rest :CustomEntityMetadata, :list, 0
|
11
|
-
end
|
12
|
-
|
13
|
-
context do
|
14
|
-
subject { attribute_metadata.dictionatyMetadata universe }
|
15
|
-
it do
|
16
|
-
expect(subject).to be_a Moysklad::Entities::CustomEntityMetadata
|
17
|
-
expect(subject.uuid).to eq attribute_metadata.dictionaryMetadataUuid
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context do
|
22
|
-
subject { attribute_metadata.entityMetadata universe }
|
23
|
-
|
24
|
-
it do
|
25
|
-
expect(subject).to be_a Moysklad::Entities::EmbeddedEntityMetadata
|
26
|
-
expect(subject.uuid).to eq attribute_metadata.entityMetadataUuid
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::Attribute do
|
4
|
-
let(:good_uuid) { 'eb77ad57-2e22-11e4-4030-002590a28eca' }
|
5
|
-
|
6
|
-
before do
|
7
|
-
stub_rest :Good, good_uuid
|
8
|
-
stub_rest :EmbeddedEntityMetadata, :list, 0
|
9
|
-
stub_rest :CustomEntity, :list, 0
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:goods_resource) { Moysklad::Resources::Goods.indexed client: client }
|
13
|
-
let(:good) { goods_resource.get good_uuid }
|
14
|
-
|
15
|
-
let(:attribute_with_id_custom) { good.attributes.first }
|
16
|
-
let(:attribute_with_text) { good.attributes.second }
|
17
|
-
|
18
|
-
it 'should get ' do
|
19
|
-
expect(good).to be_a Moysklad::Entities::Good
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'аттрибут типа ID_CUSTOM' do
|
23
|
-
subject { attribute_with_id_custom }
|
24
|
-
|
25
|
-
it do
|
26
|
-
expect(subject.metadata(universe)).to be_a Moysklad::Entities::AttributeMetadata
|
27
|
-
expect(subject.metadata(universe).name).to eq 'Вставки'
|
28
|
-
expect(subject.attributeName(universe)).to eq 'Вставки'
|
29
|
-
end
|
30
|
-
|
31
|
-
it do
|
32
|
-
expect(subject.get_value(universe)).to eq "Культ. жемчуг, куб. циркон"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::Country do
|
4
|
-
|
5
|
-
before do
|
6
|
-
stub_rest :Country, :list, 0
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:resource) { Moysklad::Resources::Countries.indexed client: client }
|
10
|
-
|
11
|
-
describe do
|
12
|
-
let(:country) { resource.all.first }
|
13
|
-
|
14
|
-
subject { country }
|
15
|
-
|
16
|
-
it do
|
17
|
-
expect(subject).to be_a Moysklad::Entities::Country
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'unicoded xml' do
|
21
|
-
expect(subject.to_xml).to start_with '<?xml version="1.0" encoding="utf-8"?>'
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::CustomEntityMetadata do
|
4
|
-
before do
|
5
|
-
stub_rest :CustomEntityMetadata, :list, 0
|
6
|
-
stub_rest :CustomEntity, :list, 0
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:resource) { Moysklad::Resources::CustomEntityMetadata.indexed client: client }
|
10
|
-
|
11
|
-
describe do
|
12
|
-
let(:custom_entity_metadata) { resource.all.first }
|
13
|
-
|
14
|
-
subject { custom_entity_metadata }
|
15
|
-
|
16
|
-
it do
|
17
|
-
expect(subject).to be_a Moysklad::Entities::CustomEntityMetadata
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'unicoded xml' do
|
21
|
-
expect(subject.to_xml).to start_with '<?xml version="1.0" encoding="utf-8"?>'
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'entities' do
|
25
|
-
|
26
|
-
it do
|
27
|
-
expect(subject.entities(universe)).to be_a Array
|
28
|
-
expect(subject.entities(universe).first).to be_a Moysklad::Entities::CustomEntity
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::CustomEntity do
|
4
|
-
|
5
|
-
before do
|
6
|
-
stub_rest :CustomEntityMetadata, :list, 0
|
7
|
-
stub_rest :CustomEntity, :list, 0
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:resource) { Moysklad::Resources::CustomEntities.indexed client: client }
|
11
|
-
|
12
|
-
describe do
|
13
|
-
let(:custom_entity) { resource.all.first }
|
14
|
-
|
15
|
-
subject { custom_entity }
|
16
|
-
|
17
|
-
it do
|
18
|
-
expect(subject).to be_a Moysklad::Entities::CustomEntity
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'unicoded xml' do
|
22
|
-
expect(subject.to_xml).to start_with '<?xml version="1.0" encoding="utf-8"?>'
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'entityMetadata' do
|
26
|
-
|
27
|
-
it do
|
28
|
-
expect(subject.entityMetadata(universe)).to be_a Moysklad::Entities::CustomEntityMetadata
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Entities::Good do
|
4
|
-
let(:good_uuid) { 'eb77ad57-2e22-11e4-4030-002590a28eca' }
|
5
|
-
|
6
|
-
let(:raw_response) { File.new "./spec/fixtures/Good_#{good_uuid}.raw" }
|
7
|
-
let(:raw_features_list_response) { File.new "./spec/fixtures/Feature_list.raw" }
|
8
|
-
|
9
|
-
before do
|
10
|
-
stub_request(:get, "https://online.moysklad.ru/exchange/rest/ms/xml/Good/#{good_uuid}").to_return(raw_response)
|
11
|
-
stub_request(:get, "https://online.moysklad.ru/exchange/rest/ms/xml/Feature/list?start=0").to_return(raw_features_list_response)
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:goods_resource) { Moysklad::Resources::Goods.indexed client: client }
|
15
|
-
let(:good) { goods_resource.get good_uuid }
|
16
|
-
|
17
|
-
describe 'features' do
|
18
|
-
let(:features) { good.features universe }
|
19
|
-
|
20
|
-
it do
|
21
|
-
expect(features).to be_a Array
|
22
|
-
expect(features.count).to eq 3
|
23
|
-
end
|
24
|
-
|
25
|
-
context do
|
26
|
-
subject { features.first }
|
27
|
-
it do
|
28
|
-
expect(subject).to be_a Moysklad::Entities::Feature
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'to_xml' do
|
34
|
-
expect(subject.to_xml).to be_a String
|
35
|
-
expect(subject.to_xml).to include "<?xml"
|
36
|
-
expect(subject.to_xml).to include "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'attribute' do
|
40
|
-
it do
|
41
|
-
expect(good.attributes).to be_a Array
|
42
|
-
expect(good.attributes.first).to be_a Moysklad::Entities::Attribute
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'image' do
|
47
|
-
let(:xml) { File.read './spec/fixtures/good_with_image.xml' }
|
48
|
-
subject { described_class.parse xml }
|
49
|
-
|
50
|
-
it do
|
51
|
-
expect(subject.images.image.count).to eq 1
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::Countries do
|
4
|
-
before do
|
5
|
-
stub_rest 'Country'
|
6
|
-
end
|
7
|
-
|
8
|
-
subject { described_class.new client: client }
|
9
|
-
|
10
|
-
it do
|
11
|
-
expect(subject.list.count).to eq 248
|
12
|
-
end
|
13
|
-
|
14
|
-
it do
|
15
|
-
expect(subject.send(:list_path)).to eq "exchange/rest/ms/xml/Country/list"
|
16
|
-
end
|
17
|
-
|
18
|
-
it do
|
19
|
-
expect(subject.list.first).to be_a Moysklad::Entities::Country
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::CustomEntityMetadata do
|
4
|
-
|
5
|
-
describe do
|
6
|
-
subject { described_class.new client: client }
|
7
|
-
it 'should get list' do
|
8
|
-
expect(subject.send(:list_path)).to eq "exchange/rest/ms/xml/CustomEntityMetadata/list"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::EmbeddedEntityMetadataIndexed do
|
4
|
-
|
5
|
-
let(:article_uuid) { 'dc410ce3-505a-11e4-90a2-8eca00496371' }
|
6
|
-
|
7
|
-
before do
|
8
|
-
stub_rest :EmbeddedEntityMetadata, :list, 0
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'subresource' do
|
12
|
-
let(:metadata_resource) { Moysklad::Resources::EmbeddedEntityMetadata.indexed client: client }
|
13
|
-
subject { metadata_resource.subresource_by_name :GoodFolder }
|
14
|
-
|
15
|
-
it { expect(subject).to be_a Moysklad::Resources::Subresource }
|
16
|
-
it { expect(subject.items.first).to be_a Moysklad::Entities::AttributeMetadata }
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::EmbeddedEntityMetadata do
|
4
|
-
describe do
|
5
|
-
subject { described_class.new client: client }
|
6
|
-
it 'should get list' do
|
7
|
-
expect(subject.send(:list_path)).to eq "exchange/rest/ms/xml/EmbeddedEntityMetadata/list"
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::GoodFolders do
|
4
|
-
|
5
|
-
it 'should be GoodFolder' do
|
6
|
-
expect(described_class.entity_class).to eq Moysklad::Entities::GoodFolder
|
7
|
-
end
|
8
|
-
|
9
|
-
describe 'resource' do
|
10
|
-
subject { Moysklad::Resources::GoodFolders.new client: client }
|
11
|
-
|
12
|
-
it 'should get item' do
|
13
|
-
expect(subject.send(:list_path)).to eq "exchange/rest/ms/xml/GoodFolder/list"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::Indexed do
|
4
|
-
let(:items_count) { total_consignment_count }
|
5
|
-
|
6
|
-
before do
|
7
|
-
stub_consignments_requests
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:resource) { Moysklad::Resources::Indexed.new consignments_resource }
|
11
|
-
|
12
|
-
subject { resource }
|
13
|
-
|
14
|
-
it 'загружено верное количество данных' do
|
15
|
-
expect(subject.all.count).to eq items_count
|
16
|
-
expect(subject.send(:index).count).to eq items_count
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'кешированные данные' do
|
20
|
-
# uuid элемента со второй страницы
|
21
|
-
let(:uuid) { 'eb18d236-2e22-11e4-ddb1-002590a28eca'}
|
22
|
-
|
23
|
-
before do
|
24
|
-
subject.all
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'элемет получаем из кеша' do
|
28
|
-
expect(subject.find uuid).to be_a consignments_resource.class.entity_class
|
29
|
-
expect(WebMock).to have_requested(:get, resource_list_url(consignments_resource, 0)).once
|
30
|
-
expect(WebMock).to have_requested(:get, resource_list_url(consignments_resource, 1000)).once
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'filtered?' do
|
35
|
-
subject { resource.send :filtered?, item, filter }
|
36
|
-
|
37
|
-
context 'под фильтр попадает все если фильтр пуст' do
|
38
|
-
let(:item) { double }
|
39
|
-
let(:filter) { {} }
|
40
|
-
it do
|
41
|
-
expect(subject).to be true
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'отсеивает что не надо' do
|
46
|
-
let(:item) { double some_key: 123 }
|
47
|
-
let(:filter) { { some_key: 124} }
|
48
|
-
it do
|
49
|
-
expect(subject).to be false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
context 'фильтрует что надо' do
|
53
|
-
let(:item) { double some_key: 123 }
|
54
|
-
let(:filter) { { some_key: 123} }
|
55
|
-
it do
|
56
|
-
expect(subject).to be true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::Stock do
|
4
|
-
it 'should be loaded' do
|
5
|
-
expect(Moysklad::Resources::Stock).to be_a Class
|
6
|
-
end
|
7
|
-
|
8
|
-
let(:resource) { Moysklad::Resources::Stock.new client: client }
|
9
|
-
|
10
|
-
describe do
|
11
|
-
it 'should get list' do
|
12
|
-
expect(resource.send(:list_path)).to eq "exchange/rest/stock/xml"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'listWithConsignments' do
|
17
|
-
subject { resource.listWithConsignments }
|
18
|
-
before do
|
19
|
-
stub_stock_rest_with_consignments
|
20
|
-
end
|
21
|
-
it do
|
22
|
-
expect(subject.count).to eq 879
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'stock item' do
|
26
|
-
subject { resource.listWithConsignments.first }
|
27
|
-
|
28
|
-
it do
|
29
|
-
expect(subject).to be_a Moysklad::Entities::StockTO
|
30
|
-
end
|
31
|
-
|
32
|
-
it do
|
33
|
-
expect(subject.consignmentName).to_not be_empty
|
34
|
-
end
|
35
|
-
|
36
|
-
it do
|
37
|
-
expect(subject.consignmentUuid).to_not be_empty
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'no consignments' do
|
43
|
-
let(:count) { 516 }
|
44
|
-
subject { resource }
|
45
|
-
|
46
|
-
before do
|
47
|
-
stub_stock_rest
|
48
|
-
end
|
49
|
-
|
50
|
-
it do
|
51
|
-
expect(subject.page.count).to eq count
|
52
|
-
end
|
53
|
-
|
54
|
-
it do
|
55
|
-
expect(subject.all.count).to eq count
|
56
|
-
end
|
57
|
-
|
58
|
-
it do
|
59
|
-
expect(subject.all.first).to be_a Moysklad::Entities::StockTO
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::Warehouses do
|
4
|
-
|
5
|
-
before do
|
6
|
-
stub_rest 'Warehouse'
|
7
|
-
end
|
8
|
-
|
9
|
-
describe do
|
10
|
-
subject { described_class.new client: client }
|
11
|
-
it do
|
12
|
-
expect(subject.list.count).to eq 2
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should get list' do
|
16
|
-
expect(subject.list.first).to be_a Moysklad::Entities::Warehouse
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Moysklad::Resources::Workflows do
|
4
|
-
before do
|
5
|
-
stub_rest 'Workflow'
|
6
|
-
end
|
7
|
-
|
8
|
-
subject { described_class.new client: client }
|
9
|
-
|
10
|
-
it do
|
11
|
-
expect(subject.list.count).to eq 2
|
12
|
-
end
|
13
|
-
|
14
|
-
it do
|
15
|
-
expect(subject.send(:list_path)).to eq "exchange/rest/ms/xml/Workflow/list"
|
16
|
-
end
|
17
|
-
|
18
|
-
it do
|
19
|
-
expect(subject.list.first).to be_a Moysklad::Entities::Workflow
|
20
|
-
end
|
21
|
-
end
|