Sha256: f88a9b457a8ae721924398761b8899b4ed88e4a356e1a3cc1c917526f0a56f68

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

require 'spec_helper'
require 'druid/elements'

describe Druid::Elements::OrderedList do
  describe "interface" do
    let(:element) { double 'element' }
    let(:ol) { Druid::Elements::OrderedList.new(element) }

    it "should return a list item when indexed" do
      allow(element).to receive(:ols).and_return(element)
      expect(element).to receive(:[])
      ol[1]
    end

    it "should know how many list items it contains" do
      allow(element).to receive(:ols).and_return([element])
      expect(ol.items).to eql 1
    end

    it "should iterate over the list items" do
      expect(ol).to receive(:items).and_return(2)
      allow(ol).to receive(:[])
      count = 0
      ol.each do
        count += 1
      end
      expect(count).to eql 2
    end

    it "should register as tag_name :ol" do
      expect(Druid::Elements.element_class_for(:ol)).to be Druid::Elements::OrderedList
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
druid-ts-1.2.4 spec/druid/elements/ordered_list_spec.rb
druid-ts-1.2.3 spec/druid/elements/ordered_list_spec.rb