1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00
teamcapybara--capybara/lib/capybara/spec/session/find_field_spec.rb
Jonas Nicklas 3070441cab Find and locate now do the same thing
The distinction was confusing and not helpful
under any circumstances really.
2010-07-19 20:18:16 +02:00

26 lines
833 B
Ruby

shared_examples_for "find_field" do
describe '#find_field' do
before do
@session.visit('/form')
end
it "should find any field" do
@session.find_field('Dog').value.should == 'dog'
@session.find_field('form_description').text.should == 'Descriptive text goes here'
@session.find_field('Region')[:name].should == 'form[region]'
end
it "should raise error if the field doesn't exist" do
running do
@session.find_field('Does not exist')
end.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 do
@session.field_labeled('Does not exist')
end.should raise_error(Capybara::ElementNotFound)
end
end
end