Don't redirect ajax requests to getting_started. Fix a possible source of errors and backfill a couple tests
This commit is contained in:
parent
3db11cf38d
commit
42a361dcce
2 changed files with 19 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ class AspectsController < ApplicationController
|
||||||
@selected_contacts.uniq!
|
@selected_contacts.uniq!
|
||||||
|
|
||||||
# redirect to signup
|
# redirect to signup
|
||||||
if (current_user.getting_started == true || @aspects.blank?) && !request.format.mobile?
|
if (current_user.getting_started == true || @aspects.blank?) && !request.format.mobile? && !request.format.js?
|
||||||
redirect_to getting_started_path
|
redirect_to getting_started_path
|
||||||
else
|
else
|
||||||
if params[:sort_order].blank? and session[:sort_order].blank?
|
if params[:sort_order].blank? and session[:sort_order].blank?
|
||||||
|
|
|
||||||
|
|
@ -111,8 +111,25 @@ describe AspectsController do
|
||||||
assigns(:posts).should == @posts.reverse
|
assigns(:posts).should == @posts.reverse
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
context 'with getting_started = true' do
|
||||||
|
before do
|
||||||
|
@alice.getting_started = true
|
||||||
|
@alice.save
|
||||||
|
end
|
||||||
|
it 'redirects to getting_started' do
|
||||||
|
get :index
|
||||||
|
response.should redirect_to getting_started_path
|
||||||
|
end
|
||||||
|
it 'does not redirect mobile users to getting_started' do
|
||||||
|
get :index, :format => :mobile
|
||||||
|
response.should_not be_redirect
|
||||||
|
end
|
||||||
|
it 'does not redirect ajax to getting_started' do
|
||||||
|
get :index, :format => :js
|
||||||
|
response.should_not be_redirect
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'performance', :performance => true do
|
context 'performance', :performance => true do
|
||||||
before do
|
before do
|
||||||
require 'benchmark'
|
require 'benchmark'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue