[rspec-users] requests: is it possible to put the fill_in's into a method?

S Ahmed sahmed1020 at gmail.com
Sun Feb 26 16:36:45 UTC 2012

I'm testing my signup page, and I want to minimize the duplication of the
fill_in code for filling in the form fields and testing how my page reacts
when someone forgets to enter input.

fill_in "....", with: "abc123"

Any tricks of doing this?

Say I have 10 fill_in calls, so say I want to test to make sure the form
fails if any combination of the last 4 fields are missing.

I was thinking of putting the first 6 fill_in calls into a method, and then
calling that method:

it "should ..." do
  # now enter 3 of the 4 and verify

it "should ..." do
  # now enter a different combination of the last 4 fields

I haven't tested this yet, just brainstorming, any other advise?

I wish things worked liked attribute hashes where you could just call
.merge and change the default set.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120226/fbd7260c/attachment.html>

More information about the rspec-users mailing list