summaryrefslogtreecommitdiff
path: root/spec/controllers/root_controller_spec.rb
blob: abbbf6855fc731492db6c9173908d8a18bdf795d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'spec_helper'

describe RootController do
  describe 'GET show' do
    context 'with a user' do
      let(:user) { create(:user) }

      before do
        sign_in(user)
        allow(subject).to receive(:current_user).and_return(user)
      end

      context 'who has customized their dashboard setting' do
        before do
          user.update_attribute(:dashboard, 'stars')
        end

        it 'redirects to their specified dashboard' do
          get :show
          expect(response).to redirect_to starred_dashboard_projects_path
        end
      end

      context 'who uses the default dashboard setting' do
        it 'renders the default dashboard' do
          get :show
          expect(response).to render_template 'dashboard/show'
        end
      end
    end
  end
end