Sha256: bb7737e782bec86146e677e34f4285b6a497719fbda15f91efb4ca7e9fc2ed59
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
module RspecResourceSupport def raw_consignment_0_list File.new './spec/fixtures/Consignment_list_0.raw' end def raw_consignment_1000_list File.new './spec/fixtures/Consignment_list_1000.raw' end def total_consignment_count 1280 end def feature_list_items_count 863 end def raw_feature_list File.new './spec/fixtures/Feature_list.raw' end def feature_list_items_count 863 end def stub_rest type, action=:list, start=nil, file=nil url = "https://online.moysklad.ru/exchange/rest/ms/xml/#{type}/#{action}" url << "?start=#{start}" if start stub_request(:get, url).to_return File.new( file || "./spec/fixtures/#{type}_#{action}.raw" ) end def stub_stock_rest_with_consignments url = 'https://online.moysklad.ru/exchange/rest/stock/xml?showConsignments=true' stub_request(:get, url).to_return File.new "./spec/fixtures/Stock_showConsignments.raw" end def stub_stock_rest url = 'https://online.moysklad.ru/exchange/rest/stock/xml' stub_request(:get, url).to_return File.new "./spec/fixtures/Stock.raw" end def client @client ||= AmoCRM::Client.new end def universe @universe ||= AmoCRM::Universe.new client: client end def resource_list_url res=nil, start=nil res ||= resource url = AmoCRM::Client::URL + '/' + res.send(:list_path) url+="?start=#{start}" if start return url end def consignments_resource @consignments_resource ||= AmoCRM::Resources::Consignments.new client: client end def stub_consignments_requests stub_request(:get, resource_list_url(consignments_resource, 0)).to_return(raw_consignment_0_list) stub_request(:get, resource_list_url(consignments_resource, 1000)).to_return(raw_consignment_1000_list) end end RSpec.configure do |config| config.include RspecResourceSupport end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amo_crm-0.2.2 | spec/support/resource.rb |