Ohhh, now I understand. If you are inside a test, you might be able to
run Ruby code like inside a Rails console.


Creating a user:

  u = User.new(:email_address => '[email protected]', :password =>
'SuperSecret', :name => 'Someone')
  u.save


Creating a key:

  key = u.lifecycle.generate_key


Setting the key:

  u.lifecycle.provided_key = key
  u.lifecycle.valid_key? # Should return true


And finally, running the lifecycle:

  u.lifecycle.accept_invitation!(u)


Alternatively, you should be able to use the key in the URL, as if the
user had clicked the email.

Finally, you should also be able to hack the state of the user with:

  u.update_attribute(:state, 'active')


Warm regards,
Ignacio

El 31-03-2015 a las 21:04, Thierry B escribió:
> Hi Ignacio,
> 
> Thanks for your answer.
> In fact, I'm looking for a way to activate the user creation
> programatically (with or without Capybara)
> To use the route "activate_from_email_path", I need to get the
> activation key. How can I find it ?
> 
> Thank you for your help
> 
> Regards
> Thierry
> 
> 
> On Sunday, March 22, 2015 at 6:41:44 PM UTC+1, Ignacio Huerta wrote:
> 
>     You are probably looking for "activate_from_email_path". You can take a
>     look at all the routes by running "rake routes".
> 
>     Warm regards,
>     Ignacio
> 
>     El 12-03-2015 a las 16:34, Thierry B escribió:
>     > Hi,
>     >
>     > I'm testing the user signup process with capybara.
>     > Each new user need to activate his account.
>     > How can I do that in my test ? How can I get the activation url ?
>     >
>     > Thanks for your help
>     >
>     > Thierry
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "Hobo Users" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to [email protected] <javascript:>
>     > <mailto:[email protected] <javascript:>>.
>     > To post to this group, send email to [email protected]
>     <javascript:>
>     > <mailto:[email protected] <javascript:>>.
>     > Visit this group at http://groups.google.com/group/hobousers
>     <http://groups.google.com/group/hobousers>.
>     > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to