mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
raising an error if someone forgets to provide a hash to fill_in
This commit is contained in:
parent
32b3b6a796
commit
a550cc458a
2 changed files with 6 additions and 1 deletions
|
@ -62,6 +62,7 @@ module Capybara
|
|||
|
||||
def fill_in(locator, options={})
|
||||
msg = "cannot fill in, no text field, text area or password field with id, name, or label '#{locator}' found"
|
||||
raise "Must pass a hash containing 'with'" unless options.kind_of? Hash && !options.index(:with).nil?
|
||||
locate(:xpath, XPath.fillable_field(locator), msg).set(options[:with])
|
||||
end
|
||||
|
||||
|
|
|
@ -83,6 +83,10 @@ shared_examples_for "fill_in" do
|
|||
extract_results(@session)['name'].should == 'Ford Prefect'
|
||||
end
|
||||
|
||||
it "should throw an exception if a hash containing 'with' is not provided" do
|
||||
lambda{@session.fill_in 'Name', 'ignu'}.should raise_error
|
||||
end
|
||||
|
||||
context "with ignore_hidden_fields" do
|
||||
before { Capybara.ignore_hidden_elements = true }
|
||||
after { Capybara.ignore_hidden_elements = false }
|
||||
|
|
Loading…
Reference in a new issue