Sha256: addfb8dd6a88c42650c89c18df1da57f3022b09ef50527ed3514b3c88168a107

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 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 client
    @client ||= Moysklad::Client.new
  end

  def resource_list_url res=nil, start=nil
    res ||= resource
    url = Moysklad::Client::URL + '/' + res.send(:list_path)
    url+="?start=#{start}" if start

    return url
  end

  def consignments_resource
    @consignments_resource ||= Moysklad::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
moysklad-0.0.2 spec/support/resource.rb