daze
2011-Jun-16  00:59 UTC
Authlogic: Trying to login in my Cucumber test - Authlogic::Session::Activation::NotActivatedError
In a Cucumber step definition, I''m trying to login, but I keep getting
this error:
You must activate the Authlogic::Session::Base.controller with a
controller object before creating objects
(Authlogic::Session::Activation::NotActivatedError)
My code:
Given /^I am the logged in (.+) "(.+)"$/ do |role, login|
  user = User.create!(
    :login => login,
    :password => "some_password",
    :password_confirmation => "some_password",
    :role => role,
    :email => "some_email-oHC15RC7JGRl57MIdRCFDg@public.gmane.org"
  )
  #Authlogic::Session::Base.controller
Authlogic::ControllerAdapters::RailsAdapter.new(self)
  UserSession.create(
    :login => login,
    :password => "some_password"
  )
end
I found that commented out bit - Authlogic::Session::Base.controller
Authlogic::ControllerAdapters::RailsAdapter.new(self) - online, but it
leads to "save" not working.
Assistance greatly appreciated!
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Andrew Skegg
2011-Jun-16  04:27 UTC
Re: Authlogic: Trying to login in my Cucumber test - Authlogic::Session::Activation::NotActivatedError
daze <dmonopoly10@...> writes:> > In a Cucumber step definition, I''m trying to login, but I keep getting > this error: > > You must activate the Authlogic::Session::Base.controller with a > controller object before creating objects > (Authlogic::Session::Activation::NotActivatedError)Are you using confirmable? It looks like the user is not confirmed. Luckily, devise has a trick for that:> > My code: > > Given /^I am the logged in (.+) "(.+)"$/ do |role, login| > user = User.create!( > :login => login, > :password => "some_password", > :password_confirmation => "some_password", > :role => role, > :email => "some_email@..." > )Try Given /^I am the logged in (.+) "(.+)"$/ do |role, login| user = User.create!( :login => login, :password => "some_password", :password_confirmation => "some_password", :role => role, :email => "some_email@..." ).confirm! Note the "confirm!" method call. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
daze
2011-Jun-16  17:54 UTC
Re: Authlogic: Trying to login in my Cucumber test - Authlogic::Session::Activation::NotActivatedError
Thanks, but I''m not using Devise; I''m using Authlogic, so I get the error, undefined method ''confirm!'' There must be a straight-forward way to do this with Authlogic... On Jun 16, 12:27 am, Andrew Skegg <andrewsk...-BUHhN+a2lJ4@public.gmane.org> wrote:> daze <dmonopoly10@...> writes: > > > In a Cucumber step definition, I''m trying to login, but I keep getting > > this error: > > > You must activate the Authlogic::Session::Base.controller with a > > controller object before creating objects > > (Authlogic::Session::Activation::NotActivatedError) > > Are you using confirmable? It looks like the user is not confirmed. Luckily, > devise has a trick for that: > > > > > My code: > > > Given /^I am the logged in (.+) "(.+)"$/ do |role, login| > > user = User.create!( > > :login => login, > > :password => "some_password", > > :password_confirmation => "some_password", > > :role => role, > > :email => "some_email@..." > > ) > > Try > > Given /^I am the logged in (.+) "(.+)"$/ do |role, login| > user = User.create!( > :login => login, > :password => "some_password", > :password_confirmation => "some_password", > :role => role, > :email => "some_email@..." > ).confirm! > > Note the "confirm!" method call.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.