Given /^I have filled in the form$/ do |details|
details.hashes.each |pair|
Can't see this working because you've got no place to collect details
However
Given /^I have filled in the form with (.*)$/ do |details|
details.hashes.each |pair|
would work, but you'd have to do some tricky stuff to get your hash out.
-----
Given Joe has filled in the form:
| field | value |
| x | 1 |
| y | 2 |
For this to work the step that matches has to collect two thing so really
you need
Given Joe has filled in foo with bar
| field | value |
| x | 1 |
| y | 2 |
and a matcher
Given /^Joe has filled in (.*) with (.*)$/ do |field, value|
>From that you could try
Given /^Form filled in correctly$/
Given "Joe has filled in foo with bar"
| field | value |
| x | 1 |
| y | 2 |
but I doubt that would work as I think you need the "More Examples:"
statement. Also don't think embedding tables in step definitions is a good
idea.
----
You could use convention over configuration to do more filling in with less
variables. For example I fill in user forms using just the login name to
generate the other fields
e.g. login - fred, password - fredpass, email [EMAIL PROTECTED] etc.
Now a step can take one parameter fred and fill in many details
e.g. using webrat
When /^I fill in signup details for (.*) $/ do |user|
fill_in(:login, :with => user)
fill_in(:email, :with => user + '@example.com')
fill_in(:password, :with => user + 'pass')
fill_in('user[password_confirmation]', :with => user + 'pass')
end
When I fill in signup details for fred
HTH
Andrew
2008/12/5 Pau Cor <[EMAIL PROTECTED]>
> Ben Mabey wrote:
> > you will just have to
> > experiment and see.
>
> Thanks for the reply!
> So far all my experiments have failed :/
>
> Anyone else have any ideas?
>
> Paul
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users