Sha256: 2a32fac3dd1a388ede08499ddb9e2dfa8bb04dbdaa6974c083989d8d1d031fb3

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

RSpec.describe NgrokAPI::Models::Listable do
  before(:each) do
    @client = class_double("APIKeysClient")
    @listable = NgrokAPI::Models::Listable.new(
      client: @client,
      result: api_key_results,
      list_property: 'keys',
      klass: NgrokAPI::Models::APIKey
    )
  end

  describe "#==" do
    it "is equal if the results are the same" do
      listable2 = NgrokAPI::Models::Listable.new(
        client: @client,
        result: api_key_results,
        list_property: 'keys',
        klass: NgrokAPI::Models::APIKey
      )
      expect(@listable == listable2).to eq true
    end
  end

  describe "#to_s" do
    it "stringifies as result.to_s" do
      expect(@listable.to_s).to eq api_key_results.to_s
    end
  end

  describe "keys" do
    it "consistent of APIKeys" do
      expect(@listable.items.size).to eq api_key_results['keys'].size
    end
  end

  describe "iter" do
    it "is a PagedIterator" do
      expect(@listable.iter.class).to eq NgrokAPI::PagedIterator
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ngrok-api-0.18.0 spec/ngrokapi/models/listable_spec.rb
ngrok-api-0.17.0 spec/ngrokapi/models/listable_spec.rb
ngrok-api-0.16.0 spec/ngrokapi/models/listable_spec.rb
ngrok-api-0.15.0 spec/ngrokapi/models/listable_spec.rb
ngrok-api-0.14.0 spec/ngrokapi/models/listable_spec.rb
ngrok-api-0.12.0 spec/ngrokapi/models/listable_spec.rb