require 'spec_helper' describe Symbiont::Generators do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { DefinitionTest.new(watir_browser) } describe "radio web objects" do context "when declared in a definition" do it "should generate methods for referencing the radio" do watir_definition.should respond_to(:include_tax_radio) watir_definition.should respond_to(:include_tax_radio_button) watir_definition.should respond_to(:include_tax_object) end it "should generate methods for interacting with the radio" do watir_definition.should respond_to(:include_tax_exists?) watir_definition.should respond_to(:include_tax_visible?) watir_definition.should respond_to(:include_tax_enabled?) watir_definition.should respond_to(:include_tax?) watir_definition.should respond_to(:include_tax_?) watir_definition.should respond_to(:include_tax!) watir_definition.should respond_to(:include_tax_selected?) watir_definition.should respond_to(:include_tax_set?) watir_definition.should respond_to(:set_include_tax) end end context "when used by the watir platform" do it "should locate the radio" do watir_browser.should_receive(:radio).and_return(watir_browser) web_object = watir_definition.include_tax_radio web_object.should_not be_nil web_object.should be_instance_of Symbiont::WebObjects::Radio end it "should determine if a radio exists" do watir_browser.should_receive(:radio).twice.and_return(watir_browser) watir_browser.should_receive(:exists?).twice.and_return(watir_browser) watir_definition.include_tax_exists?.should be_true watir_definition.include_tax?.should be_true end it "should determine if a radio is visible" do watir_browser.should_receive(:radio).twice.and_return(watir_browser) watir_browser.should_receive(:visible?).twice.and_return(watir_browser) watir_definition.include_tax_visible?.should be_true watir_definition.include_tax_?.should be_true end it "should determine if a radio is enabled" do watir_browser.should_receive(:radio).twice.and_return(watir_browser) watir_browser.should_receive(:enabled?).twice.and_return(watir_browser) watir_definition.include_tax_enabled?.should be_true watir_definition.include_tax!.should be_true end it "should determine if a radio is set" do watir_browser.should_receive(:radio).twice.and_return(watir_browser) watir_browser.should_receive(:set?).twice.and_return(watir_browser) watir_definition.include_tax_selected?.should be_true watir_definition.include_tax_set?.should be_true end it "should set a radio" do watir_browser.should_receive(:radio).twice.and_return(watir_browser) watir_browser.should_receive(:set).twice.and_return(watir_browser) watir_definition.select_include_tax watir_definition.set_include_tax end #it "should clear a radio" do # watir_browser.should_receive(:radio).and_return(watir_browser) # watir_browser.should_receive(:clear).and_return(watir_browser) # watir_definition.clear_include_tax #end end end end