Cucumber form entry testing with pickle models

10 views
Skip to first unread message

RailinAndWailin

unread,
Dec 7, 2009, 7:35:10 PM12/7/09
to pickle

Hdc5 rey there all..

So: I'm a little noobish, so please bear with me here.

Given cucumber/pickle/factory_girl
When I test form entry
Then I run into a problem

my scenerio is as so:
Scenerio: user fills out the registration form
Given a user exists # now here cuke 4.4 knows to hit up
factory_girl, right? (no error)
When he fills out the registration form
Then ....

So, right here I went and started a helper method for the world
object.
Plagiarizing http://rubyflare.com/2009/10/28/pickle-my-cucumber/
module FormSubmissionHelpers
def fill_in_account_form
fill_in(" account_name", :with => "Mocra")
fill_in("account_abn", :with => "12 345 678 901")
click_button("Submit")
end
end
World(FormSubmissionHelpers)
now. that's pretty ugly and can't exactly reuse that for any other
model creation forms.
The pickle Model object doesn't have an accessible attribute hash
rigth?
Can I loop over like: fill_in("firstname", :with => Model
($1).firstname)?

Ian White

unread,
Dec 8, 2009, 2:48:53 AM12/8/09
to pickle-...@googlegroups.com
> The pickle Model object doesn't have an accessible attribute hash
> right?
No it doesn't, but something like what you suggest seems like a good
idea.

Even though Pickle currently doesn't help with this particular aspect,
it does with:

> Given a user exists


look in step_definitions/pickle_steps.rp to see examples of the sort
of things that you can do with pickle.

Cheers,
Ian
> --
>
> You received this message because you are subscribed to the Google
> Groups "pickle" group.
> To post to this group, send email to pickle-...@googlegroups.com.
> To unsubscribe from this group, send email to pickle-cucumb...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/pickle-cucumber?hl=en
> .
>
>

RailinAndWailin

unread,
Dec 8, 2009, 12:39:05 PM12/8/09
to pickle
Thanks for the quick reply, Ian.
I appreciate your work.
> > Plagiarizinghttp://rubyflare.com/2009/10/28/pickle-my-cucumber/
Reply all
Reply to author
Forward
0 new messages