require 'spec_helper' describe Symbiont::Generators do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { DefinitionTest.new(watir_browser) } describe "cell web objects" do context "when declared in a definition" do it "should generate methods for referencing the cell" do watir_definition.should respond_to(:totalValue_cell) watir_definition.should respond_to(:totalValue_object) end it "should generate methods for interacting with the cell" do watir_definition.should respond_to(:totalValue_exists?) watir_definition.should respond_to(:totalValue_visible?) watir_definition.should respond_to(:totalValue?) watir_definition.should respond_to(:totalValue_?) watir_definition.should respond_to(:totalValue) end end context "when used by the watir platform" do it "should locate the table cell" do watir_browser.should_receive(:td).and_return(watir_browser) web_object = watir_definition.totalValue_cell web_object.should_not be_nil web_object.should be_instance_of Symbiont::WebObjects::TableCell end it "should determine if a table cell exists" do watir_browser.should_receive(:td).twice.and_return(watir_browser) watir_browser.should_receive(:exists?).twice.and_return(watir_browser) watir_definition.totalValue_exists?.should be_true watir_definition.totalValue?.should be_true end it "should determine if a table cell is visible" do watir_browser.should_receive(:td).twice.and_return(watir_browser) watir_browser.should_receive(:present?).twice.and_return(watir_browser) watir_definition.totalValue_visible?.should be_true watir_definition.totalValue_?.should be_true end it "should return the text of a table cell" do watir_browser.should_receive(:td).and_return(watir_browser) watir_browser.should_receive(:text).and_return("testing") watir_definition.totalValue.should == "testing" end end end end