Add optional signup.

This commit is contained in:
Marin Jankovski 2012-11-06 14:30:48 +01:00
parent b07e1b3aed
commit 296cdd591f
14 changed files with 125 additions and 25 deletions

View file

@ -32,6 +32,7 @@ describe Notify do
end
it 'contains the new user\'s password' do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(false)
should have_body_text /#{new_user.password}/
end
@ -40,6 +41,35 @@ describe Notify do
end
end
describe 'for users that signed up, the email' do
let(:example_site_path) { root_path }
let(:new_user) { create(:user, email: 'newguy@example.com', password: "securePassword") }
subject { Notify.new_user_email(new_user.id, new_user.password) }
it 'is sent to the new user' do
should deliver_to new_user.email
end
it 'has the correct subject' do
should have_subject /^gitlab \| Account was created for you$/i
end
it 'contains the new user\'s login name' do
should have_body_text /#{new_user.email}/
end
it 'should not contain the new user\'s password' do
Gitlab.config.gitlab.stub(:signup_enabled).and_return(true)
should_not have_body_text /#{new_user.password}/
end
it 'includes a link to the site' do
should have_body_text /#{example_site_path}/
end
end
context 'for a project' do
describe 'items that are assignable, the email' do
let(:assignee) { create(:user, email: 'assignee@example.com') }