1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Add options to check

This commit is contained in:
CJ Kihlbom and Jonas Nicklas 2013-02-24 16:48:25 +01:00
parent def1e395aa
commit d62a31f39d
2 changed files with 16 additions and 2 deletions

View file

@ -75,8 +75,8 @@ module Capybara
#
# @param [String] locator Which check box to check
#
def check(locator)
find(:checkbox, locator).set(true)
def check(locator, options={})
find(:checkbox, locator, options).set(true)
end
##

View file

@ -82,4 +82,18 @@ Capybara::SpecHelper.spec "#check" do
end.to raise_error(Capybara::ElementNotFound)
end
end
context "with :exact option" do
it "should accept partial matches when false" do
@session.check('Ham', :exact => false)
@session.click_button('awesome')
extract_results(@session)['pets'].should include('hamster')
end
it "should not accept partial matches when true" do
expect do
@session.check('Ham', :exact => true)
end.to raise_error(Capybara::ElementNotFound)
end
end
end