This repository has been archived by the owner on Jun 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 316
/
admin_controller_test.rb
executable file
·82 lines (65 loc) · 2.1 KB
/
admin_controller_test.rb
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# require 'test_helper'
# class AdminControllerTest < ActionController::TestCase
# fixtures :users, :categories, :roles
# def test_should_get_index
# login_as :admin
# get :users
# assert_response :success
# end
# def test_should_not_get_index
# login_as :quentin
# get :users
# assert_redirected_to login_path
# end
# def test_should_not_activate_user
# users(:quentin).update_attribute('activation_code', 'test')
# users(:quentin).update_attribute('activated_at', nil)
# login_as :quentin
# patch :activate_user, :id => users(:quentin).id
# assert !users(:quentin).active?
# assert_redirected_to login_path
# end
# def test_should_not_activate_user_js
# users(:quentin).update_attribute('activation_code', 'test')
# users(:quentin).update_attribute('activated_at', nil)
# get :activate_user, :id => users(:quentin).id, :format => 'js'
# assert !users(:quentin).active?
# end
# def test_should_activate_user
# users(:quentin).update_attribute('activation_code', 'test')
# users(:quentin).update_attribute('activated_at', nil)
# login_as :admin
# patch :activate_user, :id => users(:quentin).id
# assert_response :redirect
# assert users(:quentin).reload.active?
# end
# def test_should_deactivate_user
# login_as :admin
# patch :deactivate_user, :id => users(:quentin).id
# assert_response :redirect
# assert !users(:quentin).reload.active?
# end
# test "should list users" do
# login_as :admin
# get :users
# assert_response :success
# assert !assigns(:users).empty?
# end
# test "should search users" do
# login_as :admin
# get :users, :login => 'uenti'
# assert_response :success
# assert_equal assigns(:users).first, users(:quentin)
# end
# test "should clear cache" do
# login_as :admin
# get :clear_cache
# assert_redirected_to admin_dashboard_path
# end
# test "should get subscribers xml" do
# authorize_as :admin
# get :subscribers, :format => :xml
# assert_response :success
# assert assigns(:users).any?
# end
# end