-
-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy pathaccount_setup_spec.rb
More file actions
53 lines (37 loc) · 1.18 KB
/
account_setup_spec.rb
File metadata and controls
53 lines (37 loc) · 1.18 KB
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
# frozen_string_literal: true
RSpec.describe "account setup" do
def fill_in_fields(username:, confirm: "my-password")
fill_in("Username", with: username)
fill_in("Password", with: "my-password")
fill_in("Confirm", with: confirm)
click_on("Next")
end
it "allows a user to sign up" do
visit "/"
fill_in_fields(username: "my-username")
expect(page).to have_text("Logged in as my-username")
end
it "shows an error when passwords do not match" do
visit "/"
fill_in_fields(username: "my-username", confirm: "wrong-password")
expect(page).to have_content("doesn't match")
end
it "allows a second user to sign up" do
Setting::UserSignup.create!(enabled: true)
create(:user)
visit "/"
expect(page).to have_link("sign up")
end
it "completes sign up for a second user" do
Setting::UserSignup.create!(enabled: true)
create(:user)
visit(setup_password_path)
fill_in_fields(username: "second-user")
expect(page).to have_text("Logged in as second-user")
end
it "does not allow a second user to signup when not enabled" do
create(:user)
visit "/"
expect(page).to have_no_link("sign up")
end
end