Authlogic openid: getting undefined method openid_identifier? error in functional test
Posted
by usr
on Stack Overflow
See other posts from Stack Overflow
or by usr
Published on 2010-01-26T21:31:30Z
Indexed on
2010/04/15
1:03 UTC
Read the original article
Hit count: 489
I use Authlogic with the Authlogic-openid addon (I gem installed ruby- openid and script/plugin install git://github.com/rails/open_id_authentication.git) and get two errors.
First when running functional test, I get an undefined method openid_identifier? message on a line in my new.html.erb file when running the UsersControllerTest. The line is:
<% if @user.openid_identifier? %>
When running script/console I can access this method without any problem.
Second when testing the openid functionality and registering a new user to my application using openid and using my blogspot account for that I get the following in my log file:
Generated checkid_setup request to http://www.blogger.com/openid-server.g
with assocication ...
Redirected to http://www.blogger.com/openid-server.g?openid.assoc_handle=...
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.call):
app/controllers/users_controller.rb:44:in `create'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
The code in the users_controller is straight forward:
def create
respond_to do |format|
@user.save do |result|
if result
flash[:notice] = t('Thanks for signing up!')
format.html { redirect_to :action => 'index' }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
format.html { render :action => "new" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end
end
The line giving the error being @user.save do |result|...
I feel I'm missing something pretty basic but I have been staring at this for too long because I can't find what it is. I checked with the code on Railscasts episodes 160 and 170 and the bones GitHub project but found nothing.
Thanks for your help, usr
© Stack Overflow or respective owner