Sha256: 6ac8642c3d098a33159a316012894965bf7356caa6b5f6bc6a419f45538b52f7

Contents?: true

Size: 810 Bytes

Versions: 12

Compression:

Stored size: 810 Bytes

Contents

require 'spec_helper'

describe Conekta::List do

  include_context "API 2.0.0"

  let(:list) do
    response = JSON.parse(File.read("spec/support/fixtures/orders.json"))
    order_list = Conekta::List.new("Order",response)
    order_list.load_from(response)
    order_list
  end

  context "moving cursor" do
    it "moves cursor forward" do
      window = Conekta::Order.where({"limit" => 5, "next" => list[9].id})
      expect(window.first.id).to eq(list[10].id)
      window.next(limit: 1)
      expect(window.first.id).to eq(list[15].id)
    end

    it "moves cursor backwards" do
      window = Conekta::Order.where({"limit" => 5, "next" => list[14].id})
      expect(window.first.id).to eq(list[15].id)
      window.previous(limit: 1)
      expect(window.first.id).to eq(list[14].id)
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
conekta-2.6.0 spec/conekta/2.0.0/list_spec.rb
conekta-tiempometa-2.4.2 spec/conekta/2.0.0/list_spec.rb
conekta-2.5.0 spec/conekta/2.0.0/list_spec.rb
conekta-2.4.2 spec/conekta/2.0.0/list_spec.rb
conekta-2.4.1 spec/conekta/2.0.0/list_spec.rb
conekta-2.4.0 spec/conekta/2.0.0/list_spec.rb
conekta-2.3.0 spec/conekta/2.0.0/list_spec.rb
conekta-2.0.0 spec/conekta/2.0.0/list_spec.rb
conekta-1.1.3 spec/conekta/2.0.0/list_spec.rb
conekta-1.1.2 spec/conekta/2.0.0/list_spec.rb
conekta-1.1.1 spec/conekta/2.0.0/list_spec.rb
conekta-1.1.0 spec/conekta/2.0.0/list_spec.rb