Rename element_labeled to field_labeled
This commit is contained in:
parent
354c8c1f4e
commit
09d765d7c4
@ -175,7 +175,7 @@ module Webrat
|
|||||||
@dom ||= Hpricot(scoped_html)
|
@dom ||= Hpricot(scoped_html)
|
||||||
end
|
end
|
||||||
|
|
||||||
def element_labeled(label)
|
def field_labeled(label)
|
||||||
find_field(label, TextField, TextareaField, CheckboxField, RadioField, HiddenField)
|
find_field(label, TextField, TextareaField, CheckboxField, RadioField, HiddenField)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -161,6 +161,6 @@ module Webrat
|
|||||||
def_delegators :current_scope, :click_button, :clicks_button
|
def_delegators :current_scope, :click_button, :clicks_button
|
||||||
def_delegators :current_scope, :should_see
|
def_delegators :current_scope, :should_see
|
||||||
def_delegators :current_scope, :should_not_see
|
def_delegators :current_scope, :should_not_see
|
||||||
def_delegators :current_scope, :element_labeled
|
def_delegators :current_scope, :field_labeled
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||||
|
|
||||||
|
|
||||||
describe "element_labeled" do
|
describe "field_labeled" do
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def using_this_html html
|
def using_this_html html
|
||||||
@ -11,27 +11,27 @@ describe "element_labeled" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def element_labeled label
|
def field_labeled label
|
||||||
@label = label
|
@label = label
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_return_a type, opts
|
def should_return_a type, opts
|
||||||
it "should return a textfield" do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_an_id_of id, opts
|
def with_an_id_of id, opts
|
||||||
it "should return an element with the correct id" do
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_raise_error_matching regexp, opts
|
def should_raise_error_matching regexp, opts
|
||||||
it "should raise with wrong label" do
|
it "should raise with wrong label" do
|
||||||
lambda {
|
lambda {
|
||||||
@session.element_labeled(opts[:for])
|
@session.field_labeled(opts[:for])
|
||||||
}.should raise_error(regexp)
|
}.should raise_error(regexp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user