Satish / restful-authentication

Generates common user authentication code for Rails/Merb, with a full test/unit and rspec suite and optional Acts as State Machine support built-in.
http://weblog.techno-weenie.net
MIT License
82 stars 19 forks source link

rspec 2 on Rails 3 - access_control_spec.rb issues #10

Open sshreibati opened 13 years ago

sshreibati commented 13 years ago

I've had testing the rspec because I'm on rspec 2 I assume. Here are some of my issues:

1.) "include AuthenticatedSystem" needs to be included 2.) in the "before" statement where they add routes the old way was "ActionController::Routing::Routes.add_route /login_is_required', :controller => 'access_control_test', :action => 'login_is_required'"

INSTEAD USE begin _routes = Savingsgame::Application.routes _routes.disable_clear_and_finalize = true _routes.clear! Savingsgame::Application.routes_reloader.paths.each{ |path| load(path) } _routes.draw do

here you can add any route you want

    get "/login_not_required", :to => "access_control_test#login_not_required"
    get "/login_is_required", :to => "access_control_test#login_is_required"
  end
  ActiveSupport.on_load(:action_controller) { _routes.finalize! }
ensure
  _routes.disable_clear_and_finalize = false
end

3.) Because I'm using rspec 2, I need to change all the route_for, params_for and has_text, but those are easy, just look up the https://github.com/rspec/rspec-rails

sshreibati commented 13 years ago

Oh, you probably want to add the following in the spec_helper.rb instead of each spec. include AuthenticatedTestHelper include AuthenticatedSystem