require 'spec_helper' describe Symbiont::Generators do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { DefinitionTest.new(watir_browser) } describe "span generators" do context "when declared in a definition" do it "should generate methods for referencing the span" do watir_definition.should respond_to(:inline_span) watir_definition.should respond_to(:inline_object) end it "should generate methods for interacting with the span" do watir_definition.should respond_to(:inline_exists?) watir_definition.should respond_to(:inline_visible?) watir_definition.should respond_to(:inline?) watir_definition.should respond_to(:inline_?) watir_definition.should respond_to(:inline) end end context "when used by the watir platform" do it "should locate the span" do watir_browser.should_receive(:span).and_return(watir_browser) web_object = watir_definition.inline_span web_object.should_not be_nil web_object.should be_instance_of Symbiont::WebObjects::Span end it "should determine if a span exists" do watir_browser.should_receive(:span).twice.and_return(watir_browser) watir_browser.should_receive(:exists?).twice.and_return(watir_browser) watir_definition.inline_exists?.should be_true watir_definition.inline?.should be_true end it "should determine if a span is visible" do watir_browser.should_receive(:span).twice.and_return(watir_browser) watir_browser.should_receive(:present?).twice.and_return(watir_browser) watir_definition.inline_visible?.should be_true watir_definition.inline_?.should be_true end it "should return the text of a span" do watir_browser.should_receive(:span).and_return(watir_browser) watir_browser.should_receive(:text).and_return("testing") watir_definition.inline.should == "testing" end it "should call a block on the span if specified" do watir_definition.part_object.should == "part" end end end end