Sha256: 2188449defd5dedc2a8ebbdb1928eba0c0fe29175baa3a304afdf2d5922c9bc8
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 KB
Contents
require 'spec_helper' describe Symbiont::WebObjects::OrderedList do describe "implementation" do let(:ordered_list_object) { Symbiont::WebObjects::OrderedList } it "should allow locators to be used" do [:class, :id, :index, :xpath, :name].each do |t| locator = ordered_list_object.provide_locator_for t => 'value' locator.keys.first.should == t end end it "should register with a ordered list (ol) tag" do ::Symbiont::WebObjects.get_class_for(:ol).should == ::Symbiont::WebObjects::OrderedList end context "on the watir platform" do let(:ol_element) { double('ol_element') } let(:watir_ordered_list) { Symbiont::WebObjects::OrderedList.new(ol_element) } it "should return a list item when indexed" do ol_element.stub(:ols).and_return([ol_element]) ol_element.stub(:find_elements).and_return(ol_element) ol_element.stub(:map).and_return([ol_element]) ol_element.stub(:parent).and_return(ol_element) ol_element.stub(:element).and_return(ol_element) ol_element.stub(:==).and_return(true) watir_ordered_list[1] end it "should know how many list items it contains" do ol_element.stub(:ols).and_return([ol_element]) ol_element.stub(:find_elements).and_return(ol_element) ol_element.stub(:map).and_return([ol_element]) ol_element.stub(:parent).and_return(ol_element) ol_element.stub(:element).and_return(ol_element) ol_element.stub(:==).and_return(true) watir_ordered_list.items.should == 1 end it "should iterate over the list items" do watir_ordered_list.should_receive(:items).and_return(5) watir_ordered_list.stub(:[]) count = 0 watir_ordered_list.each { |item| count += 1 } count.should == 5 end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
symbiont-0.2.1 | spec/symbiont/web_objects/ordered_list_spec.rb |
symbiont-0.2.0 | spec/symbiont/web_objects/ordered_list_spec.rb |