Weird Issue with rspec and authlogic-openid
May 24 2009I’ve been playing around rspec in my application which also uses AuthLogic’s OpenID. When doing
rake spec
I get the following, very weird error:
(in /Users/Michael/r/wc) /Users/Michael/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1964:in `method_missing': undefined method `config' for #<Class:0x263efdc> (NoMethodError) from /Library/Ruby/Gems/1.8/gems/authlogic-oid-1.0.3/lib/authlogic_openid/acts_as_authentic.rb:35:in `optional_fields=' from /Users/Michael/r/wc/app/models/user.rb:3 from /Library/Ruby/Gems/1.8/gems/authlogic-2.0.13/lib/authlogic/acts_as_authentic/base.rb:37:in `acts_as_authentic' from /Users/Michael/r/wc/app/models/user.rb:2 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
As seen above I’m using version 1.0.3 of the source code. For the life of me, I couldn’t figure out what was wrong. What was even stranger was the code was working when running the site. It turns out, config got changed to rw_config, and the gem repository at rubyforge hasn’t been updated to the latest 1.0.4 which includes this change:
Change from using config to the new rw_config. Requires the latest version of authlogic. config was too general of a name and was causing conflicts for people in their own projects.
So I changed the acts_as_authentic.rb file so config is named rw_config, and everything worked fine.
I’d love to find a good reference on how rspec loads gems, and why this isn’t an issue when running the site. I’m also interested in knowning how to pull content as a gem from github source (the openid gem isn’t at gems.github.com).