Skip to content

Instantly share code, notes, and snippets.

@yellow5
Created January 11, 2011 17:52
Show Gist options
  • Save yellow5/774792 to your computer and use it in GitHub Desktop.
Save yellow5/774792 to your computer and use it in GitHub Desktop.
Some info related to the exploration of errors in cucumber when including thinking_sphinx indexes and devise as the authentication system
I think our problem is related to this: http://www.lostincode.net/blog/testing-devise-controllers
The test is consistently failing just loading the root path with...
ActionController::UnknownAction (ActionController::UnknownAction)
/Users/cameron/.rvm/gems/ree-1.8.7-2010.02@ch-admin/gems/devise-1.0.9/lib/devise/controllers/internal_helpers.rb:65:in `is_devise_resource?'
So, why not investigate what the method has? The method is in 'gems/devise-1.0.9/lib/devise/controllers/internal_helpers.rb:64
def is_devise_resource? #:nodoc:
raise ActionController::UnknownAction unless devise_mapping && devise_mapping.allows?(controller_name)
end
So, what are the values passed to unless? I dumped out some info in dev mode via webrick loading the home page...
devise_mapping: #<Devise::Mapping:0x1036c51e8 @sign_out_via=:get, @path_names={:sign_in=>"login", :password=>"password", :sign_out=>"logout"}, @path_prefix="/", @name=:admin, @route_options={}, @for=[:database_authenticatable, :recoverable, :validatable, :trackable], @klass="Admin", @as=:admins>
devise_mapping? true
controler_name: sessions
devise_mapping.allows?(controller_name)? true
Lovely, but what about in cucumber when sphinx indexes are part of MedicalProvider?
devise_mapping: #<Devise::Mapping:0x103947b50 @sign_out_via=:get, @name=:admin, @klass="Admin", @to=Admin(id: integer, email: string, encrypted_password: string, password_salt: string, confirmation_token: string, confirmed_at: datetime, confirmation_sent_at: datetime, reset_password_token: string, remember_token: string, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime, username: string, role: string), @path_names={:sign_in=>"login", :sign_out=>"logout"}, @route_options={}, @path_prefix="/", @for=[], @as=:admins>
devise_mapping? true
controler_name: sessions
devise_mapping.allows?(controller_name)? false
Balls! The devise_mapping has alternate values and devise_mapping.allows?('sessions') is now false!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment