summaryrefslogtreecommitdiff
path: root/test/functional/page_controller_test.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /test/functional/page_controller_test.rb
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
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