From 09d765d7c413f11149a15006b2f300a3e27e5ed1 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sat, 25 Oct 2008 12:15:16 -0400 Subject: [PATCH] Rename element_labeled to field_labeled --- lib/webrat/core/scope.rb | 2 +- lib/webrat/core/session.rb | 2 +- spec/api/element_labeled_spec.rb | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/webrat/core/scope.rb b/lib/webrat/core/scope.rb index 099cf10..113d5db 100644 --- a/lib/webrat/core/scope.rb +++ b/lib/webrat/core/scope.rb @@ -175,7 +175,7 @@ module Webrat @dom ||= Hpricot(scoped_html) end - def element_labeled(label) + def field_labeled(label) find_field(label, TextField, TextareaField, CheckboxField, RadioField, HiddenField) end diff --git a/lib/webrat/core/session.rb b/lib/webrat/core/session.rb index e4b2363..6cc198c 100644 --- a/lib/webrat/core/session.rb +++ b/lib/webrat/core/session.rb @@ -161,6 +161,6 @@ module Webrat def_delegators :current_scope, :click_button, :clicks_button def_delegators :current_scope, :should_see def_delegators :current_scope, :should_not_see - def_delegators :current_scope, :element_labeled + def_delegators :current_scope, :field_labeled end end diff --git a/spec/api/element_labeled_spec.rb b/spec/api/element_labeled_spec.rb index 547e40b..b8cc61d 100644 --- a/spec/api/element_labeled_spec.rb +++ b/spec/api/element_labeled_spec.rb @@ -1,7 +1,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") -describe "element_labeled" do +describe "field_labeled" do class << self def using_this_html html @@ -11,27 +11,27 @@ describe "element_labeled" do end end - def element_labeled label + def field_labeled label @label = label yield end def should_return_a type, opts it "should return a textfield" do - @session.element_labeled(opts[:for]).should be_an_instance_of(type) + @session.field_labeled(opts[:for]).should be_an_instance_of(type) end end def with_an_id_of id, opts it "should return an element with the correct id" do - @session.element_labeled(opts[:for]).should match_id(id) + @session.field_labeled(opts[:for]).should match_id(id) end end def should_raise_error_matching regexp, opts it "should raise with wrong label" do lambda { - @session.element_labeled(opts[:for]) + @session.field_labeled(opts[:for]) }.should raise_error(regexp) end end