-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathadmin_users_test.rb
More file actions
44 lines (30 loc) · 915 Bytes
/
admin_users_test.rb
File metadata and controls
44 lines (30 loc) · 915 Bytes
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
require "application_system_test_case"
class AdminUsersTest < ApplicationSystemTestCase
setup do
create(:user, email: "admin@user.de", password: "admin", admin: true)
@user = create(:user, email: "test@user.de", password: "test", admin: false, is_blocked: false)
create(:coach, user: @user)
visit admin_users_path
fill_in "Email", with: "admin@user.de"
fill_in "Password", with: "admin"
click_on "Sign in"
end
test "Giving and removing admin rights" do
click_on "Make admin"
assert @user.reload.admin?
click_on "Remove rights"
assert !@user.reload.admin?
end
test "Deleting user" do
click_on "Delete"
assert_equal User.count, 1
end
test "Block coach" do
click_on "Block"
assert @user.reload.is_blocked?
assert_button "Unblock"
click_on "Unblock"
assert !@user.reload.is_blocked?
assert_button "Block"
end
end