DG MS; don't redirect to legacy getting started if you're a beta user
This commit is contained in:
parent
13b60cc5c2
commit
01d5c0473a
3 changed files with 30 additions and 13 deletions
|
|
@ -106,10 +106,17 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
stored_location_for(:user) || (current_user.getting_started? ? getting_started_path : root_path)
|
||||
stored_location_for(:user) || current_user_redirect_path
|
||||
end
|
||||
|
||||
def max_time
|
||||
params[:max_time] ? Time.at(params[:max_time].to_i) : Time.now + 1
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_user_redirect_path
|
||||
return person_path(current_user.person) if current_user.beta?
|
||||
current_user.getting_started? ? getting_started_path : root_path
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -32,17 +32,5 @@ describe ApplicationController do
|
|||
response.headers['X-Git-Revision'].should == '02395'
|
||||
end
|
||||
end
|
||||
#this context is commented out because the code to do it gets applied at environment load.
|
||||
#context 'without git info' do
|
||||
# before do
|
||||
# AppConfig.config_vars.delete(:git_update)
|
||||
# AppConfig.config_vars.delete(:git_revision)
|
||||
# end
|
||||
# it 'does not set the headers if there is no git info' do
|
||||
# get :index
|
||||
# response.headers.keys.should_not include('X-Git-Update')
|
||||
# response.headers.keys.should_not include('X-Git-Revision')
|
||||
# end
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -251,5 +251,27 @@ describe UsersController do
|
|||
response.should be_success
|
||||
end
|
||||
end
|
||||
|
||||
# This logic lives in application controller
|
||||
describe "#after_sign_in_path_for" do
|
||||
before do
|
||||
@controller.stub(:current_user).and_return(eve)
|
||||
end
|
||||
|
||||
context 'getting started true on user' do
|
||||
before do
|
||||
eve.update_attribute(:getting_started, true)
|
||||
end
|
||||
|
||||
it "redirects to getting started if the user has getting started set to true" do
|
||||
@controller.after_sign_in_path_for(eve).should == getting_started_path
|
||||
end
|
||||
|
||||
it "does not redirect to getting started if the user is beta" do
|
||||
Role.add_beta(eve.person)
|
||||
@controller.after_sign_in_path_for(eve).should == person_path(eve.person)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue