amo_crm 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +28 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CHANGELOG.md +22 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +29 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +1 -0
  10. data/Rakefile +14 -0
  11. data/amo_crm.gemspec +41 -0
  12. data/dump_amocrm_account.rb +7 -0
  13. data/lib/amo_crm.rb +31 -0
  14. data/lib/amo_crm/client.rb +98 -0
  15. data/lib/amo_crm/client/error.rb +18 -0
  16. data/lib/amo_crm/client/errors.rb +16 -0
  17. data/lib/amo_crm/entities.rb +14 -0
  18. data/lib/amo_crm/entities/account.rb +7 -0
  19. data/lib/amo_crm/entities/attachment_document.rb +16 -0
  20. data/lib/amo_crm/entities/attribute.rb +71 -0
  21. data/lib/amo_crm/entities/attribute_metadata.rb +38 -0
  22. data/lib/amo_crm/entities/barcode.rb +19 -0
  23. data/lib/amo_crm/entities/base.rb +5 -0
  24. data/lib/amo_crm/entities/collection.rb +12 -0
  25. data/lib/amo_crm/entities/common.rb +15 -0
  26. data/lib/amo_crm/entities/common_object.rb +27 -0
  27. data/lib/amo_crm/entities/company.rb +30 -0
  28. data/lib/amo_crm/entities/company_concern.rb +20 -0
  29. data/lib/amo_crm/entities/consignment.rb +22 -0
  30. data/lib/amo_crm/entities/contact.rb +29 -0
  31. data/lib/amo_crm/entities/contract.rb +2 -0
  32. data/lib/amo_crm/entities/country.rb +10 -0
  33. data/lib/amo_crm/entities/custom_entity.rb +18 -0
  34. data/lib/amo_crm/entities/custom_entity_metadata.rb +36 -0
  35. data/lib/amo_crm/entities/custom_field.rb +6 -0
  36. data/lib/amo_crm/entities/custom_field_definition.rb +13 -0
  37. data/lib/amo_crm/entities/custom_field_value.rb +5 -0
  38. data/lib/amo_crm/entities/custom_fields.rb +24 -0
  39. data/lib/amo_crm/entities/custom_fields_definition.rb +4 -0
  40. data/lib/amo_crm/entities/customer_order.rb +51 -0
  41. data/lib/amo_crm/entities/customer_order_position.rb +22 -0
  42. data/lib/amo_crm/entities/embedded_entity_metadata.rb +18 -0
  43. data/lib/amo_crm/entities/error.rb +13 -0
  44. data/lib/amo_crm/entities/feature.rb +23 -0
  45. data/lib/amo_crm/entities/good.rb +34 -0
  46. data/lib/amo_crm/entities/good_folder.rb +10 -0
  47. data/lib/amo_crm/entities/good_ref.rb +12 -0
  48. data/lib/amo_crm/entities/image.rb +21 -0
  49. data/lib/amo_crm/entities/images.rb +10 -0
  50. data/lib/amo_crm/entities/lead.rb +28 -0
  51. data/lib/amo_crm/entities/my_company.rb +12 -0
  52. data/lib/amo_crm/entities/page.rb +5 -0
  53. data/lib/amo_crm/entities/price.rb +15 -0
  54. data/lib/amo_crm/entities/price_type.rb +13 -0
  55. data/lib/amo_crm/entities/sale_price.rb +18 -0
  56. data/lib/amo_crm/entities/sale_prices.rb +10 -0
  57. data/lib/amo_crm/entities/slot.rb +10 -0
  58. data/lib/amo_crm/entities/stock_to.rb +33 -0
  59. data/lib/amo_crm/entities/warehouse.rb +15 -0
  60. data/lib/amo_crm/entities/workflow.rb +11 -0
  61. data/lib/amo_crm/entities/workflow_state.rb +8 -0
  62. data/lib/amo_crm/entities/xml_fix.rb +14 -0
  63. data/lib/amo_crm/errors.rb +1 -0
  64. data/lib/amo_crm/resources.rb +18 -0
  65. data/lib/amo_crm/resources/account.rb +30 -0
  66. data/lib/amo_crm/resources/base.rb +149 -0
  67. data/lib/amo_crm/resources/companies.rb +27 -0
  68. data/lib/amo_crm/resources/contacts.rb +23 -0
  69. data/lib/amo_crm/resources/custom_entity_metadata.rb +18 -0
  70. data/lib/amo_crm/resources/custom_field.rb +28 -0
  71. data/lib/amo_crm/resources/embedded_entity_metadata.rb +20 -0
  72. data/lib/amo_crm/resources/embedded_entity_metadata_indexed.rb +7 -0
  73. data/lib/amo_crm/resources/indexed.rb +89 -0
  74. data/lib/amo_crm/resources/leads.rb +31 -0
  75. data/lib/amo_crm/resources/stock.rb +36 -0
  76. data/lib/amo_crm/resources/subresource.rb +21 -0
  77. data/lib/amo_crm/resources/where_filter.rb +26 -0
  78. data/lib/amo_crm/response.rb +7 -0
  79. data/lib/amo_crm/universe.rb +44 -0
  80. data/lib/amo_crm/version.rb +3 -0
  81. data/scripts/rest.sh +25 -0
  82. data/spec/fixtures/302.raw +15 -0
  83. data/spec/fixtures/400.raw +8 -0
  84. data/spec/fixtures/401.html +1 -0
  85. data/spec/fixtures/401_2.html +1 -0
  86. data/spec/fixtures/405.raw +9 -0
  87. data/spec/fixtures/500.raw +8 -0
  88. data/spec/fixtures/502.raw +8 -0
  89. data/spec/fixtures/Consignment_list_0.raw +14 -0
  90. data/spec/fixtures/Consignment_list_1000.raw +14 -0
  91. data/spec/fixtures/Country_list.raw +14 -0
  92. data/spec/fixtures/CustomEntityMetadata_list.raw +14 -0
  93. data/spec/fixtures/CustomEntity_list.raw +14 -0
  94. data/spec/fixtures/CustomEntity_list_bad_chars.raw +17 -0
  95. data/spec/fixtures/EmbeddedEntityMetadata_list.raw +15 -0
  96. data/spec/fixtures/Feature_list.raw +14 -0
  97. data/spec/fixtures/Feature_list_1000.raw +14 -0
  98. data/spec/fixtures/Good_WithManyAttributes.raw +13 -0
  99. data/spec/fixtures/Good_e932ebe1-2e22-11e4-9406-002590a28eca.raw +12 -0
  100. data/spec/fixtures/Good_eb77ad57-2e22-11e4-4030-002590a28eca.raw +12 -0
  101. data/spec/fixtures/Goods_list.raw +14 -0
  102. data/spec/fixtures/Metadata_list.raw +14 -0
  103. data/spec/fixtures/PriceType_list.raw +14 -0
  104. data/spec/fixtures/Stock.raw +11 -0
  105. data/spec/fixtures/Stock_showConsignments.raw +11 -0
  106. data/spec/fixtures/Uom_list.raw +14 -0
  107. data/spec/fixtures/Warehouse_list.raw +14 -0
  108. data/spec/fixtures/Workflow_list.raw +15 -0
  109. data/spec/fixtures/attribute_boolean.xml +6 -0
  110. data/spec/fixtures/attribute_dictionary.xml +5 -0
  111. data/spec/fixtures/attribute_double.xml +6 -0
  112. data/spec/fixtures/attribute_file.xml +12 -0
  113. data/spec/fixtures/attribute_long.xml +6 -0
  114. data/spec/fixtures/attribute_text.xml +5 -0
  115. data/spec/fixtures/attribute_time.xml +6 -0
  116. data/spec/fixtures/attribute_url.xml +6 -0
  117. data/spec/fixtures/bad_chars.xml +6 -0
  118. data/spec/fixtures/customer_order.xml +28 -0
  119. data/spec/fixtures/good_with_attributes.raw +12 -0
  120. data/spec/fixtures/good_with_image.xml +39 -0
  121. data/spec/fixtures/resource_forbidden.raw +9 -0
  122. data/spec/fixtures/wrong_password.raw +9 -0
  123. data/spec/fixtures/wrong_type.raw +70 -0
  124. data/spec/fixtures/wrong_user.raw +9 -0
  125. data/spec/lib/amocrm/client/errors_spec.rb +102 -0
  126. data/spec/lib/amocrm/entities/attribute_metadata_spec.rb +30 -0
  127. data/spec/lib/amocrm/entities/attribute_spec.rb +36 -0
  128. data/spec/lib/amocrm/entities/country_spec.rb +25 -0
  129. data/spec/lib/amocrm/entities/custom_entity_metadata_spec.rb +34 -0
  130. data/spec/lib/amocrm/entities/custom_entity_spec.rb +34 -0
  131. data/spec/lib/amocrm/entities/customer_order_position_spec.rb +35 -0
  132. data/spec/lib/amocrm/entities/customer_order_spec.rb +58 -0
  133. data/spec/lib/amocrm/entities/good_spec.rb +55 -0
  134. data/spec/lib/amocrm/resources/base_spec.rb +61 -0
  135. data/spec/lib/amocrm/resources/countries_spec.rb +22 -0
  136. data/spec/lib/amocrm/resources/custom_entity_metadata_spec.rb +13 -0
  137. data/spec/lib/amocrm/resources/embedded_entity_metadata_indexed_spec.rb +20 -0
  138. data/spec/lib/amocrm/resources/embedded_entity_metadata_spec.rb +11 -0
  139. data/spec/lib/amocrm/resources/good_folders_spec.rb +17 -0
  140. data/spec/lib/amocrm/resources/indexed_spec.rb +61 -0
  141. data/spec/lib/amocrm/resources/stock_spec.rb +63 -0
  142. data/spec/lib/amocrm/resources/subresource_spec.rb +13 -0
  143. data/spec/lib/amocrm/resources/warehouses_spec.rb +20 -0
  144. data/spec/lib/amocrm/resources/workflows_spec.rb +21 -0
  145. data/spec/lib/amocrm/resources_spec.rb +10 -0
  146. data/spec/lib/amocrm/universe_spec.rb +53 -0
  147. data/spec/lib/amocrm_spec.rb +8 -0
  148. data/spec/spec_helper.rb +106 -0
  149. data/spec/support/resource.rb +72 -0
  150. metadata +500 -0
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Entities::CustomerOrder do
4
+ context 'generate' do
5
+ subject {
6
+ p= AmoCRM::Entities::CustomerOrderPosition.new
7
+ p.vat = 18
8
+ p.basePrice = AmoCRM::Entities::Price.new
9
+ p.basePrice.sum = 123
10
+ p.reserve = true
11
+
12
+ co = AmoCRM::Entities::CustomerOrder.new
13
+ co.sum = AmoCRM::Entities::Price.new
14
+ co.sum.sum = 456
15
+ co.description = 'Описание'
16
+ co.customerOrderPosition = p
17
+ co
18
+ }
19
+
20
+ it 'state' do
21
+ stub_rest 'Workflow', :list, 0
22
+ allow(subject).to receive(:stateUuid).and_return 'f16b0ca9-ff79-11e4-90a2-8ecb0000fdf9'
23
+ expect(subject.state universe).to be_a AmoCRM::Entities::WorkflowState
24
+ end
25
+
26
+ it 'to_xml' do
27
+ expect(subject.to_xml).to be_a String
28
+ end
29
+
30
+ it 'to_s' do
31
+ expect(subject.to_s).to be_a String
32
+ end
33
+
34
+ it 'include xml' do
35
+ expect(subject.to_xml).to include '<?xml version="1.0" encoding="utf-8"?>'
36
+ end
37
+
38
+ it 'include customerOrder' do
39
+ expect(subject.to_xml).to include "<customerOrder"
40
+ end
41
+
42
+ it 'include customerOrderPosition' do
43
+ expect(subject.to_xml).to include "<customerOrderPosition"
44
+ end
45
+ end
46
+
47
+ context 'parse' do
48
+ subject { AmoCRM::Entities::CustomerOrder.parse File.read './spec/fixtures/customer_order.xml' }
49
+
50
+ it 'include customerOrder' do
51
+ expect(subject.to_xml).to include "<customerOrder"
52
+ end
53
+
54
+ it 'include customerOrderPosition' do
55
+ expect(subject.to_xml).to include "<customerOrderPosition"
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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) { AmoCRM::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 AmoCRM::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 AmoCRM::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
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Resources::Base do
4
+ it 'should be loaded' do
5
+ expect(described_class).to be_a Class
6
+ end
7
+
8
+ describe 'правильно определяет название модели' do
9
+ let!(:entity_class) { AmoCRM::Entities::Computer = Class.new }
10
+ subject { AmoCRM::Resources::Computers = Class.new described_class }
11
+
12
+ it do
13
+ expect(subject.entity_class).to eq entity_class
14
+ end
15
+ end
16
+
17
+ describe 'испрвляет на лету xml с плохими символами' do
18
+ let(:xml) { File.read './spec/fixtures/bad_chars.xml' }
19
+ let(:client) { AmoCRM::Client.new }
20
+ let(:res) { described_class.new client: client }
21
+
22
+ before do
23
+ allow(described_class).to receive(:entity_class).and_return AmoCRM::Entities::CustomEntity
24
+ end
25
+
26
+ subject { res.send :parse_page, xml }
27
+
28
+ it do
29
+ expect{subject}.to_not raise_error
30
+ end
31
+
32
+ context 'ошибка есть если парсинг напрямую' do
33
+ before do
34
+ expect_any_instance_of(described_class).to receive(:parse_content).and_return xml
35
+ end
36
+ it do
37
+ expect{subject}.to raise_error Nokogiri::XML::SyntaxError
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ describe 'page' do
44
+ let(:resource) { AmoCRM::Resources::Features.new client: client }
45
+
46
+ before do
47
+ stub_rest :Feature
48
+ end
49
+
50
+ subject { resource.page }
51
+
52
+ it do
53
+ expect(subject).to be_a AmoCRM::Entities::Page
54
+ expect(subject.total).to eq feature_list_items_count
55
+ expect(subject.count).to eq AmoCRM::Entities::Collection::DEFAULT_COUNT
56
+ expect(subject.start).to eq 0
57
+ expect(subject.items.count).to eq feature_list_items_count
58
+ end
59
+
60
+ end
61
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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 AmoCRM::Entities::Country
20
+ end
21
+
22
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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) { AmoCRM::Resources::EmbeddedEntityMetadata.indexed client: client }
13
+ subject { metadata_resource.subresource_by_name :GoodFolder }
14
+
15
+ it { expect(subject).to be_a AmoCRM::Resources::Subresource }
16
+ it { expect(subject.items.first).to be_a AmoCRM::Entities::AttributeMetadata }
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Resources::GoodFolders do
4
+
5
+ it 'should be GoodFolder' do
6
+ expect(described_class.entity_class).to eq AmoCRM::Entities::GoodFolder
7
+ end
8
+
9
+ describe 'resource' do
10
+ subject { AmoCRM::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
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Resources::Indexed do
4
+ let(:items_count) { total_consignment_count }
5
+
6
+ before do
7
+ stub_consignments_requests
8
+ end
9
+
10
+ let(:resource) { AmoCRM::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
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Resources::Stock do
4
+ it 'should be loaded' do
5
+ expect(AmoCRM::Resources::Stock).to be_a Class
6
+ end
7
+
8
+ let(:resource) { AmoCRM::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 AmoCRM::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 AmoCRM::Entities::StockTO
60
+ end
61
+ end
62
+ end
63
+
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::Resources::Subresource do
4
+ let(:item) { double key1: 1, key2: 2 }
5
+
6
+ let(:items) { [item] }
7
+
8
+ subject { described_class.new items }
9
+
10
+ it { expect(subject.items).to eq items }
11
+
12
+ end
13
+
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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 AmoCRM::Entities::Warehouse
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe AmoCRM::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 AmoCRM::Entities::Workflow
20
+ end
21
+ end