Sha256: 471e841b71b88ae68c2dbdbbf3ba4ae881c4e1c2d838944acb7b3f05ef146a70
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'spec_helper' describe AmoCRM::Entities::Good do let(:good_uuid) { 'eb77ad57-2e22-11e4-4030-002590a28eca' } let(:raw_response) { File.new "./spec/fixtures/Good_#{good_uuid}.raw" } let(:raw_features_list_response) { File.new "./spec/fixtures/Feature_list.raw" } before do stub_request(:get, "https://online.moysklad.ru/exchange/rest/ms/xml/Good/#{good_uuid}").to_return(raw_response) stub_request(:get, "https://online.moysklad.ru/exchange/rest/ms/xml/Feature/list?start=0").to_return(raw_features_list_response) end let(:goods_resource) { AmoCRM::Resources::Goods.indexed client: client } let(:good) { goods_resource.get good_uuid } describe 'features' do let(:features) { good.features universe } it do expect(features).to be_a Array expect(features.count).to eq 3 end context do subject { features.first } it do expect(subject).to be_a AmoCRM::Entities::Feature end end end it 'to_xml' do expect(subject.to_xml).to be_a String expect(subject.to_xml).to include "<?xml" expect(subject.to_xml).to include "<?xml version=\"1.0\" encoding=\"utf-8\"?>" end describe 'attribute' do it do expect(good.attributes).to be_a Array expect(good.attributes.first).to be_a AmoCRM::Entities::Attribute end end describe 'image' do let(:xml) { File.read './spec/fixtures/good_with_image.xml' } subject { described_class.parse xml } it do expect(subject.images.image.count).to eq 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amo_crm-0.2.2 | spec/lib/amocrm/entities/good_spec.rb |