From 296cdd591f7f01ffdbe18cd6a839bbd0e624dfba Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 6 Nov 2012 14:30:48 +0100 Subject: Add optional signup. --- spec/mailers/notify_spec.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'spec/mailers') diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 01e3c3f14c4..d947f0e2882 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -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') } -- cgit v1.2.1