mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Add options to choose
This commit is contained in:
parent
1484902a0a
commit
def1e395aa
2 changed files with 16 additions and 2 deletions
|
@ -62,8 +62,8 @@ module Capybara
|
|||
#
|
||||
# @param [String] locator Which radio button to choose
|
||||
#
|
||||
def choose(locator)
|
||||
find(:radio_button, locator).set(true)
|
||||
def choose(locator, options={})
|
||||
find(:radio_button, locator, options).set(true)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -37,4 +37,18 @@ Capybara::SpecHelper.spec "#choose" do
|
|||
end.to raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
|
||||
context "with :exact option" do
|
||||
it "should accept partial matches when false" do
|
||||
@session.choose("Mal", :exact => false)
|
||||
@session.click_button('awesome')
|
||||
extract_results(@session)['gender'].should == 'male'
|
||||
end
|
||||
|
||||
it "should not accept partial matches when true" do
|
||||
expect do
|
||||
@session.choose("Mal", :exact => true)
|
||||
end.to raise_error(Capybara::ElementNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue