Aliased find_field to field_labeled for webrat compat

This commit is contained in:
Jonas Nicklas 2009-11-18 00:05:35 +01:00
parent 2ec699ad9c
commit dcc082337e
2 changed files with 8 additions and 0 deletions

View File

@ -99,6 +99,7 @@ class Capybara::Session
raise Capybara::ElementNotFound, "no field of kind #{kinds.inspect} with id or label '#{locator}' found" unless field
field
end
alias_method :field_labeled, :find_field
private

View File

@ -481,6 +481,13 @@ shared_examples_for "session" do
@session.find_field('form_description', :password_field)
}.should raise_error(Capybara::ElementNotFound)
end
it "should be aliased as 'field_labeled' for webrat compatibility" do
@session.field_labeled('Dog').value.should == 'dog'
running {
@session.field_labeled('Does not exist')
}.should raise_error(Capybara::ElementNotFound)
end
end
describe '#within' do