Sha256: cd1da4e3595bd5e423b67465594ee4710e3e37a3ffd282f648b68816ea86e4d6

Contents?: true

Size: 970 Bytes

Versions: 39

Compression:

Stored size: 970 Bytes

Contents

require 'spec_helper'

describe "Ey::Core::Collection" do
  let!(:client) { create_client(user: create_user) }

  context "with some accounts" do
    before(:each) { 50.times { create_account(client: client) } }

    describe "#total_count" do
      it "can get the total item count" do
        expect(client.accounts.all.total_count).to eq(50)
      end
    end

    describe "#first" do
      it "can get the first item" do
        account = client.accounts.all[1]

        expect(client.accounts.first(name: account.name)).to eq(account)
      end
    end

    describe "#each_page" do
      it "should yield multiple pages" do
        count = 0

        client.accounts.all.each_page { |_| count += 1 }

        expect(count).to eq(3)
      end
    end

    describe "#each_entry" do
      it "should yield multiple entries" do
        count = 0

        client.accounts.all.each_entry { |*| count += 1 }

        expect(count).to eq(50)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
ey-core-3.6.0.autoscaling1 spec/collection_spec.rb
ey-core-3.6.4 spec/collection_spec.rb
ey-core-3.6.3 spec/collection_spec.rb
ey-core-3.6.1 spec/collection_spec.rb
groove-ey-core-3.6.3 spec/collection_spec.rb
groove-ey-core-3.6.2 spec/collection_spec.rb
groove-ey-core-3.6.1 spec/collection_spec.rb
ey-core-3.5.0 spec/collection_spec.rb
ey-core-3.4.4 spec/collection_spec.rb
ey-core-3.4.2 spec/collection_spec.rb
ey-core-3.4.1 spec/collection_spec.rb
ey-core-3.4.0 spec/collection_spec.rb
ey-core-3.3.1 spec/collection_spec.rb
ey-core-3.3.0 spec/collection_spec.rb
ey-core-3.2.6 spec/collection_spec.rb
ey-core-3.2.5 spec/collection_spec.rb
ey-core-3.2.4 spec/collection_spec.rb
ey-core-3.2.3 spec/collection_spec.rb
ey-core-3.2.2 spec/collection_spec.rb
ey-core-3.2.1 spec/collection_spec.rb