Add optional signup.
This commit is contained in:
parent
b07e1b3aed
commit
296cdd591f
14 changed files with 125 additions and 25 deletions
|
@ -49,6 +49,7 @@ describe "Admin::Users" do
|
|||
end
|
||||
|
||||
it "should send valid email to user with email & password" do
|
||||
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
|
||||
User.observers.enable :user_observer do
|
||||
click_button "Save"
|
||||
user = User.last
|
||||
|
@ -58,6 +59,18 @@ describe "Admin::Users" do
|
|||
email.body.should have_content(@password)
|
||||
end
|
||||
end
|
||||
|
||||
it "should send valid email to user with email without password when signup is enabled" do
|
||||
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
|
||||
User.observers.enable :user_observer do
|
||||
click_button "Save"
|
||||
user = User.last
|
||||
email = ActionMailer::Base.deliveries.last
|
||||
email.subject.should have_content("Account was created")
|
||||
email.body.should have_content(user.email)
|
||||
email.body.should_not have_content(@password)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /admin/users/:id" do
|
||||
|
|
|
@ -53,6 +53,36 @@ describe Gitlab::API do
|
|||
end
|
||||
end
|
||||
|
||||
describe "GET /users/sign_up" do
|
||||
before do
|
||||
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
|
||||
end
|
||||
it "should redirect to sign in page if signup is disabled" do
|
||||
get "/users/sign_up"
|
||||
response.status.should == 302
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /users/sign_up" do
|
||||
before do
|
||||
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
|
||||
end
|
||||
it "should return sign up page if signup is enabled" do
|
||||
get "/users/sign_up"
|
||||
response.status.should == 200
|
||||
end
|
||||
it "should create a new user account" do
|
||||
visit new_user_registration_path
|
||||
fill_in "user_name", with: "Name Surname"
|
||||
fill_in "user_username", with: "Great"
|
||||
fill_in "user_email", with: "name@mail.com"
|
||||
fill_in "user_password", with: "password1234"
|
||||
fill_in "user_password_confirmation", with: "password1234"
|
||||
expect { click_button "Sign up" }.to change {User.count}.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /user" do
|
||||
it "should return current user" do
|
||||
get api("/user", user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue