Sha256: d2fec38ecb81ec288889b185e493ae07c07b529ff992c30014b7f3f2a0ebb448
Contents?: true
Size: 1.62 KB
Versions: 8
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' require 'druid/elements' describe Druid::Elements::OrderedList do describe "when mapping how to find an element" do it "should map watir types to same" do [:class, :id, :index, :xpath].each do |t| identifier = Druid::Elements::OrderedList.identifier_for t => 'value' expect(identifier.keys.first).to eql t end end end 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) allow(element).to receive(:find_all).and_return([element]) allow(element).to receive(:parent).and_return(element) allow(element).to receive(:element).and_return(element) allow(element).to receive(:==).and_return(true) ol[1] end it "should know how many list items it contains" do allow(element).to receive(:ols).and_return(element) allow(element).to receive(:find_all).and_return([element]) allow(element).to receive(:parent).and_return(element) allow(element).to receive(:element).and_return(element) allow(element).to receive(:==).and_return(true) 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
8 entries across 8 versions & 1 rubygems