2012-07-21 16:44:10 -04:00
|
|
|
Capybara::SpecHelper.spec '#find_by_id' do
|
|
|
|
before do
|
|
|
|
@session.visit('/with_html')
|
|
|
|
end
|
2009-12-29 22:05:38 -05:00
|
|
|
|
2012-07-21 16:44:10 -04:00
|
|
|
it "should find any element by id" do
|
|
|
|
@session.find_by_id('red').tag_name.should == 'a'
|
|
|
|
end
|
2009-12-29 22:05:38 -05:00
|
|
|
|
2012-09-06 03:33:43 -04:00
|
|
|
it "casts to string" do
|
|
|
|
@session.find_by_id(:'red').tag_name.should == 'a'
|
|
|
|
end
|
|
|
|
|
2012-07-21 16:44:10 -04:00
|
|
|
it "should raise error if no element with id is found" do
|
2012-10-30 09:26:19 -04:00
|
|
|
expect do
|
2012-07-21 16:44:10 -04:00
|
|
|
@session.find_by_id('nothing_with_this_id')
|
2012-10-30 09:26:19 -04:00
|
|
|
end.to raise_error(Capybara::ElementNotFound)
|
2009-12-29 22:05:38 -05:00
|
|
|
end
|
2010-01-18 14:33:22 -05:00
|
|
|
end
|