test/controllers/guts/application_controller_test.rb in guts-1.0.8 vs test/controllers/guts/application_controller_test.rb in guts-1.1.0
- old
+ new
@@ -1,15 +1,27 @@
-require "test_helper"
+require 'test_helper'
module Guts
class ApplicationControllerTest < ActionController::TestCase
setup do
@controller = Guts::UsersController.new
@routes = Engine.routes
end
- test "should look layout_hook file from Rails app" do
+ test 'should look for layout_hook file from Rails app' do
get :index
- assert_equal true, @response.body.include?("See you in the after")
+ assert_equal true, @response.body.include?('See you in the after')
+ end
+
+ test 'should redirect for logged in user not in admin groups' do
+ log_in guts_users(:regular_user)
+ get :index
+ assert_redirected_to new_session_path
+ end
+
+ test 'should redirect for non logged in user' do
+ log_out
+ get :index
+ assert_redirected_to new_session_path
end
end
end