summaryrefslogtreecommitdiff
path: root/spec/mailers
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2012-11-06 14:30:48 +0100
committerMarin Jankovski <maxlazio@gmail.com>2013-01-18 11:57:31 +0100
commit296cdd591f7f01ffdbe18cd6a839bbd0e624dfba (patch)
treefd910106cf092da00a7fbddfe4d6e19b1f9a00eb /spec/mailers
parentb07e1b3aedf87fdf3ec7a6855cec8194b0a30a59 (diff)
downloadgitlab-ce-296cdd591f7f01ffdbe18cd6a839bbd0e624dfba.tar.gz
Add optional signup.
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/notify_spec.rb30
1 files changed, 30 insertions, 0 deletions
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') }