From 2ff6e65b2c1ef247a3c72b8b91518190213771f5 Mon Sep 17 00:00:00 2001
From: Jonas Nicklas
Date: Tue, 12 Jan 2010 23:07:13 +0100
Subject: [PATCH] Add spec for preferring exact matches for fill_in
---
spec/dsl/fill_in_spec.rb | 6 ++++++
spec/views/form.erb | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/spec/dsl/fill_in_spec.rb b/spec/dsl/fill_in_spec.rb
index eecd08db..e51a90a4 100644
--- a/spec/dsl/fill_in_spec.rb
+++ b/spec/dsl/fill_in_spec.rb
@@ -70,6 +70,12 @@ module FillInSpec
@session.click_button('awesome')
extract_results(@session)['password'].should == 'supasikrit'
end
+
+ it "should prefer exact matches over partial matches" do
+ @session.fill_in('Name', :with => 'Ford Prefect')
+ @session.click_button('awesome')
+ extract_results(@session)['name'].should == 'Ford Prefect'
+ end
context "with a locator that doesn't exist" do
it "should raise an error" do
diff --git a/spec/views/form.erb b/spec/views/form.erb
index c5aaa5c2..b079fb27 100644
--- a/spec/views/form.erb
+++ b/spec/views/form.erb
@@ -12,6 +12,11 @@
+
+
+
+
+