Sha256: edb5e424746758e9ceaff4c899f8f1586d1475a660e478c5011a6046ef8a2b0c

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

require_relative '../spec_helper'

module SAML2
  describe IndexedObject::Array do
    it "should sort by index" do
      acses = Endpoint::Indexed::Array.new(
          [Endpoint::Indexed.new('b', 1),
           Endpoint::Indexed.new('a', 0)])
      acses.map(&:location).must_equal ['a', 'b']
    end

    it "should be accessible by index" do
      acses = Endpoint::Indexed::Array.new(
          [Endpoint::Indexed.new('b', 3),
           Endpoint::Indexed.new('a', 1)])
      acses.map(&:location).must_equal ['a', 'b']
      acses[1].location.must_equal 'a'
      acses[3].location.must_equal 'b'
      acses[0].must_equal nil
    end

    describe "#default" do
      it "should default to first entry if not otherwise specified" do
        acses = Endpoint::Indexed::Array.new(
            [Endpoint::Indexed.new('a', 0),
             Endpoint::Indexed.new('b', 1)])
        acses.default.location.must_equal 'a'
      end

      it "should default to a tagged default" do
        acses = Endpoint::Indexed::Array.new(
            [Endpoint::Indexed.new('a', 0),
             Endpoint::Indexed.new('b', 1, true)])
        acses.default.location.must_equal 'b'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
saml2-1.0.8 spec/lib/indexed_object_spec.rb
saml2-1.0.7 spec/lib/indexed_object_spec.rb
saml2-1.0.6 spec/lib/indexed_object_spec.rb
saml2-1.0.5 spec/lib/indexed_object_spec.rb
saml2-1.0.4 spec/lib/indexed_object_spec.rb
saml2-1.0.3 spec/lib/indexed_object_spec.rb
saml2-1.0.2 spec/lib/indexed_object_spec.rb
saml2-1.0.1 spec/lib/indexed_object_spec.rb
saml2-1.0.0 spec/lib/indexed_object_spec.rb