Pickle.configure do |config|
config.adapters = [:factory_girl]
config.map 'I', 'myself', 'me', 'my', :to => 'user: "me"'
end
However I get an undefined method 'me' for Cucumber::World when
running this step:
Given "I am logged in" do
Given "I am activated"
When "I login with \"#{me.email}\", \"#{me.password}\""
Then "I should see \"Logged in successfully\""
end
Has anyone successfully used mappings and have an example of the
proper usage?
The mappings feature is intended for use in step parsing rather than
step definitions.
For example(s)
Given I exist
Then 1 email should be delivered to me
Inside a step def you can use the refs with the model method
model('me')
Hope that helps
Cheers,
Ian
Sent from my iPhone
> --
>
> 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
> .
>
>
Sent from my iPhone
On 23 Dec 2009, at 20:55, Nick W <nick.w...@gmail.com> wrote:
I have this in my scenario:
Given I am logged in
Then my step definition now looks like this:
Given "I am logged in" do
me = model('I')
Given "I am activated"
When "I login with \"#{me.email}\", \"#{me.password}\""
Then "I should see \"Logged in successfully\""
end
And I get this error:
Can't find pickle model: 'user: "me"' in this scenario (RuntimeError)
Is pickle looking for a factory called "me", or do I have to define a
pickle model in called "me" in every scenario?
Thanks!
Nick
On Dec 23, 2:11 pm, Ian White <ian.w.wh...@gmail.com> wrote:
> I think I should write some better docs about this...
>
> Sent from my iPhone
>
If you add
Given "I exist"
as the 2nd line of your step, then it should work (given that you have
a user factory set up).
You could also use this as a find example, say you;ve filled in some
forms and you expect a user to exist at the end of it you could do:
Then I should exist with username: "fred"
Which would assert that a user exists with the said attributes, and
also assigning a pickle ref (the user: "me") to that, which means you
could then do (for example):
And 1 email should be sent to me
When I go to my account page
I should see "You have just signed up"
etc
Does that make sense?
Cheers,
Ian
config.map 'I', 'myself', 'me', 'my', :to => 'me: "me"'