summaryrefslogtreecommitdiff
path: root/test/functional/page_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/page_controller_test.rb')
-rw-r--r--test/functional/page_controller_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/functional/page_controller_test.rb b/test/functional/page_controller_test.rb
new file mode 100644
index 0000000..a5ae5ad
--- /dev/null
+++ b/test/functional/page_controller_test.rb
@@ -0,0 +1,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 = Factory.create(:tenant)
+ @user = Factory.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 = Factory.create(:tenant)
+ @user = Factory.create(:user)
+
+ @tenant.users << @user
+
+ session[:user_id] = nil
+ get :index
+ assert_redirected_to log_in_path
+ end
+
+end