spec/symbiont/generators/checkbox_generators_spec.rb in symbiont-0.1.9 vs spec/symbiont/generators/checkbox_generators_spec.rb in symbiont-0.2.0
- old
+ new
@@ -1,75 +1,79 @@
-require 'spec_helper'
-
-describe Symbiont::Generators do
- let(:watir_browser) { mock_browser_for_watir }
- let(:watir_definition) { DefinitionTest.new(watir_browser) }
-
- describe "checkbox web objects" do
- context "when declared in a definition" do
- it "should generate methods for referencing the checkbox" do
- watir_definition.should respond_to(:apply_tax_checkbox)
- watir_definition.should respond_to(:apply_tax_object)
- end
-
- it "should generate methods for interacting with the checkbox" do
- watir_definition.should respond_to(:apply_tax_exists?)
- watir_definition.should respond_to(:apply_tax_visible?)
- watir_definition.should respond_to(:apply_tax_enabled?)
- watir_definition.should respond_to(:apply_tax?)
- watir_definition.should respond_to(:apply_tax_?)
- watir_definition.should respond_to(:apply_tax!)
- watir_definition.should respond_to(:apply_tax_checked?)
- watir_definition.should respond_to(:check_apply_tax)
- watir_definition.should respond_to(:uncheck_apply_tax)
- end
- end
-
- context "when used by the watir platform" do
- it "should locate the checkbox" do
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
- web_object = watir_definition.apply_tax_object
- web_object.should_not be_nil
- web_object.should be_instance_of Symbiont::WebObjects::CheckBox
- end
-
- it "should determine if a checkbox exists" do
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
- watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
- watir_definition.apply_tax_exists?.should be_true
- watir_definition.apply_tax?.should be_true
- end
-
- it "should determine if a checkbox is visible" do
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
- watir_browser.should_receive(:present?).twice.and_return(watir_browser)
- watir_definition.apply_tax_visible?.should be_true
- watir_definition.apply_tax_?.should be_true
- end
-
- it "should determine if a checkbox is enabled" do
- watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
- watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
- watir_definition.apply_tax_enabled?.should be_true
- watir_definition.apply_tax!.should be_true
- end
-
- it "should determine if a checkbox is checked" do
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
- watir_browser.should_receive(:set?).and_return(true)
- watir_definition.apply_tax_checked?.should be_true
- end
-
- it "should be able to check a checkbox" do
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
- watir_browser.should_receive(:set)
- watir_definition.check_apply_tax
- end
-
- it "should be able to uncheck a checkbox" do
- watir_browser.should_receive(:checkbox).and_return(watir_browser)
- watir_browser.should_receive(:clear)
- watir_definition.uncheck_apply_tax
- end
- end
- end
-end
+require 'spec_helper'
+
+describe Symbiont::Generators do
+ let(:watir_browser) { mock_browser_for_watir }
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
+
+ describe "checkbox generators" do
+ context "when declared on a page definition" do
+ it "should generate methods for referencing the checkbox" do
+ watir_definition.should respond_to(:apply_tax_checkbox)
+ watir_definition.should respond_to(:apply_tax_object)
+ end
+
+ it "should generate methods for interacting with the checkbox" do
+ watir_definition.should respond_to(:apply_tax_exists?)
+ watir_definition.should respond_to(:apply_tax_visible?)
+ watir_definition.should respond_to(:apply_tax_enabled?)
+ watir_definition.should respond_to(:apply_tax?)
+ watir_definition.should respond_to(:apply_tax_?)
+ watir_definition.should respond_to(:apply_tax!)
+ watir_definition.should respond_to(:apply_tax_checked?)
+ watir_definition.should respond_to(:check_apply_tax)
+ watir_definition.should respond_to(:uncheck_apply_tax)
+ end
+ end
+
+ context "when used by the watir platform" do
+ it "should locate the checkbox" do
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
+ web_object = watir_definition.apply_tax_object
+ web_object.should_not be_nil
+ web_object.should be_instance_of Symbiont::WebObjects::CheckBox
+ end
+
+ it "should determine if a checkbox exists" do
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
+ watir_definition.apply_tax_exists?.should be_true
+ watir_definition.apply_tax?.should be_true
+ end
+
+ it "should determine if a checkbox is visible" do
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
+ watir_definition.apply_tax_visible?.should be_true
+ watir_definition.apply_tax_?.should be_true
+ end
+
+ it "should determine if a checkbox is enabled" do
+ watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
+ watir_browser.should_receive(:enabled?).twice.and_return(watir_browser)
+ watir_definition.apply_tax_enabled?.should be_true
+ watir_definition.apply_tax!.should be_true
+ end
+
+ it "should determine if a checkbox is checked" do
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
+ watir_browser.should_receive(:set?).and_return(true)
+ watir_definition.apply_tax_checked?.should be_true
+ end
+
+ it "should be able to check a checkbox" do
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
+ watir_browser.should_receive(:set)
+ watir_definition.check_apply_tax
+ end
+
+ it "should be able to uncheck a checkbox" do
+ watir_browser.should_receive(:checkbox).and_return(watir_browser)
+ watir_browser.should_receive(:clear)
+ watir_definition.uncheck_apply_tax
+ end
+
+ it "should call a block on the checkbox if specified" do
+ watir_definition.apply_fee_object.should == "apply_fee"
+ end
+ end
+ end
+end
\ No newline at end of file