uncaught throw 'warden' while testing custom registrations controller

457 views
Skip to first unread message

whitered

unread,
Mar 23, 2011, 6:47:03 AM3/23/11
to Devise
Hi folks,
I have created custom registration controller and trying to test it
with rspec. Although my custrom controller has no any code except for
extending Devise::RegistrationController, my spec test fails with
message 'uncaught throw warden'.

I have used setting request.env['devise.mapping'] =
Devise.mappings[:user], and I don't think that it can be related with
attempt to sign in unconfirmed user, as described in another post.

Here is sample application with the only problem test:
https://github.com/whitered/devise_error_isolated (sorry for no
english localization in it)

Any help would be greatly appreciated.

And here is one more question I got to ask: is there any way to tell
Devise not to require user confirmation in test and development
environments, only require it in production mode?

José Valim

unread,
Mar 23, 2011, 7:51:26 AM3/23/11
to Devise
That's expected. You need to test your controller through integration
tests. Unfortunately the controller tests structure in Rails is quite
limited when the rack stack (warden) is envolved.

There's a way do disable confirmation, there is a skip_confirmation?
callback you could override. Take a look at the source:

https://github.com/plataformatec/devise/blob/master/lib/devise/models/confirmable.rb

On Mar 23, 11:47 am, whitered <dmitry.zhel...@gmail.com> wrote:
> Hi folks,
> I have created custom registration controller and trying to test it
> with rspec. Although my custrom controller has no any code except for
> extending Devise::RegistrationController, my spec test fails with
> message 'uncaught throw warden'.
>
> I have used setting request.env['devise.mapping'] =
> Devise.mappings[:user], and I don't think that it can be related with
> attempt to sign in unconfirmed user, as described in another post.
>
> Here is sample application with the only problem test:https://github.com/whitered/devise_error_isolated(sorry for no
Reply all
Reply to author
Forward
0 new messages