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:
parent
def1e395aa
commit
d62a31f39d
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
||||
##
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue