summaryrefslogtreecommitdiff
path: root/test/functional/page_controller_test.rb
blob: 2bc1b8074c9543d41fcbea14c7287f5f23a2178c (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
33
34
35
require 'test_helper'

class PageControllerTest < ActionController::TestCase
  
  #test "on a fresh system you should not get index but be redirected to the setup wizard" do
  test "should be redirected to setup wizard on a fresh system" do
    session[:user_id] = nil
    get :index
    assert_redirected_to wizards_new_initial_setup_path
  end
  
  
  test "a logged in user should get index" do
    @tenant = FactoryGirl.create(:tenant)
    @user  = FactoryGirl.create(:user)
    
    @tenant.users << @user
    
    session[:user_id] = @user.id
    get :index
    assert_response :success
  end

  test "a logged out user should be redirected to the login" do
    @tenant = FactoryGirl.create(:tenant)
    @user  = FactoryGirl.create(:user)
    
    @tenant.users << @user
    
    session[:user_id] = nil
    get :index
    assert_redirected_to log_in_path
  end

end