File tree Expand file tree Collapse file tree 4 files changed +37
-3
lines changed
app/controllers/common/application Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ def render_auth_error_html(exception)
259
259
# fyi, this template will eat the alert_message
260
260
render template : 'error/permission_denied' , layout : 'notice'
261
261
else
262
- redirect_to login_path ( redirect : request . path )
262
+ redirect_to root_path ( redirect : request . path )
263
263
end
264
264
end
265
265
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ def assert_permission_denied(failure_message='missing "permission denied" messag
14
14
15
15
def assert_login_required
16
16
assert_response :redirect
17
- assert_redirected_to login_path ( redirect : @request . path )
17
+ assert_redirected_to root_path ( redirect : @request . path )
18
18
end
19
19
20
20
# can pass either a regexp of the flash error string,
Original file line number Diff line number Diff line change
1
+ #
2
+ # There's a bunch of error scenarios. This test tries to make sure crabgrass
3
+ # responds in a meaningful way:
4
+ #
5
+ # login required -> offer a login form
6
+ # permission denied -> display message
7
+ # not found -> display not found
8
+ # hidden from user -> display not found
9
+ #
10
+
11
+ require 'integration_test'
12
+
13
+ class ErrorFlowTest < IntegrationTest
14
+
15
+ def test_login_required
16
+ visit '/me/pages'
17
+ assert_content 'Login Required'
18
+ fill_in 'login' , with : 'blue'
19
+ fill_in 'password' , with : 'blue'
20
+ click_button 'Login'
21
+ assert_equal '/me/pages' , current_path
22
+ end
23
+
24
+ end
Original file line number Diff line number Diff line change @@ -5,10 +5,10 @@ class PeopleDirectoryTest < JavascriptIntegrationTest
5
5
def setup
6
6
super
7
7
@user = users ( :blue )
8
- login
9
8
end
10
9
11
10
def test_contacts
11
+ login
12
12
click_on 'People'
13
13
autocomplete 'q' , with : 'orange'
14
14
within '#user_list' do
@@ -19,6 +19,7 @@ def test_contacts
19
19
end
20
20
21
21
def test_peers
22
+ login
22
23
click_on 'People'
23
24
click_on 'Peers'
24
25
autocomplete 'q' , with : 'red'
@@ -30,6 +31,7 @@ def test_peers
30
31
end
31
32
32
33
def test_search
34
+ login
33
35
click_on 'People'
34
36
find ( '#column_left' ) . click_on 'Search'
35
37
within '#user_list' do
@@ -42,4 +44,12 @@ def test_search
42
44
end
43
45
end
44
46
47
+ def test_logged_out
48
+ visit '/'
49
+ click_on 'People'
50
+ assert_content 'Search'
51
+ assert_no_content 'Peers'
52
+ assert_no_content 'Contacts'
53
+ end
54
+
45
55
end
You can’t perform that action at this time.
0 commit comments