2015-06-10 03:59:39 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RootController do
|
2015-09-08 10:14:14 -04:00
|
|
|
describe 'GET index' do
|
2015-06-10 03:59:39 -04:00
|
|
|
context 'with a user' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
allow(subject).to receive(:current_user).and_return(user)
|
|
|
|
end
|
|
|
|
|
2015-09-25 20:04:20 -04:00
|
|
|
context 'who has customized their dashboard setting for starred projects' do
|
2015-06-10 03:59:39 -04:00
|
|
|
before do
|
|
|
|
user.update_attribute(:dashboard, 'stars')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'redirects to their specified dashboard' do
|
2015-09-08 10:14:14 -04:00
|
|
|
get :index
|
2015-06-10 03:59:39 -04:00
|
|
|
expect(response).to redirect_to starred_dashboard_projects_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-25 20:04:20 -04:00
|
|
|
context 'who has customized their dashboard setting for project activities' do
|
|
|
|
before do
|
|
|
|
user.update_attribute(:dashboard, 'project_activity')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'redirects to the activity list' do
|
|
|
|
get :index
|
|
|
|
expect(response).to redirect_to activity_dashboard_path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'who has customized their dashboard setting for starred project activities' do
|
|
|
|
before do
|
|
|
|
user.update_attribute(:dashboard, 'starred_project_activity')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'redirects to the activity list' do
|
|
|
|
get :index
|
|
|
|
expect(response).to redirect_to activity_dashboard_path(filter: 'starred')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-10 03:59:39 -04:00
|
|
|
context 'who uses the default dashboard setting' do
|
|
|
|
it 'renders the default dashboard' do
|
2015-09-08 10:14:14 -04:00
|
|
|
get :index
|
|
|
|
expect(response).to render_template 'dashboard/projects/index'
|
2015-06-10 03:59:39 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|