lib/capybara/spec/session/find_field_spec.rb in capybara-2.0.3 vs lib/capybara/spec/session/find_field_spec.rb in capybara-2.1.0.beta1

- old
+ new

@@ -23,6 +23,36 @@ @session.field_labeled('Dog').value.should == 'dog' expect do @session.field_labeled('Does not exist') end.to raise_error(Capybara::ElementNotFound) end + + context "with :exact option" do + it "should accept partial matches when false" do + @session.find_field("Explanation", :exact => false)[:name].should == "form[name_explanation]" + end + + it "should not accept partial matches when true" do + expect do + @session.find_field("Explanation", :exact => true) + end.to raise_error(Capybara::ElementNotFound) + end + end + + context "with :disabled option" do + it "should find disabled fields when true" do + @session.find_field("Disabled Checkbox", :disabled => true)[:name].should == "form[disabled_checkbox]" + end + + it "should not find disabled fields when false" do + expect do + @session.find_field("Disabled Checkbox", :disabled => false) + end.to raise_error(Capybara::ElementNotFound) + end + + it "should not find disabled fields by default" do + expect do + @session.find_field("Disabled Checkbox") + end.to raise_error(Capybara::ElementNotFound) + end + end end