summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-04-28 17:09:15 -0300
committerFelipe Artur <felipefac@gmail.com>2016-05-16 14:56:32 -0300
commitc5526a2d9a946d99d7b4a72fc488fe6e0a9ad60b (patch)
tree3c0487cb249010cff4d95d1041c46ab81b8c87f3 /spec
parent71ca2de7aabf3191c4f486ca15a78a5b7f6abd94 (diff)
downloadgitlab-ce-c5526a2d9a946d99d7b4a72fc488fe6e0a9ad60b.tar.gz
Change skip_user_confirmation_email to send_user_confirmation_email
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/registrations_controller_spec.rb12
-rw-r--r--spec/features/signup_spec.rb2
-rw-r--r--spec/models/user_spec.rb1
3 files changed, 9 insertions, 6 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index b4ab767f73e..29f1847d9a1 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -8,10 +8,10 @@ describe RegistrationsController do
end
end
- let(:user_params) { { "user"=> {"name"=>"new_user", "username"=>"new_username", "email"=>"new@user.com", "password"=>"Any_password"} } }
+ let(:user_params) { { user: { name: "new_user", username: "new_username", email: "new@user.com", password: "Any_password" } } }
- context 'when skipping email confirmation' do
- before { allow(current_application_settings).to receive(:skip_user_confirmation_email).and_return(true) }
+ context 'when sending email confirmation' do
+ before { allow(current_application_settings).to receive(:send_user_confirmation_email).and_return(false) }
it 'logs user in directly' do
post(:create, user_params)
@@ -20,12 +20,12 @@ describe RegistrationsController do
end
end
- context 'when not skipping email confirmation' do
- before { allow(current_application_settings).to receive(:skip_user_confirmation_email).and_return(false) }
+ context 'when not sending email confirmation' do
+ before { allow(current_application_settings).to receive(:send_user_confirmation_email).and_return(true) }
it 'does not authenticate user and sends confirmation email' do
post(:create, user_params)
- expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params["user"]["email"])
+ expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
expect(subject.current_user).to be_nil
end
end
diff --git a/spec/features/signup_spec.rb b/spec/features/signup_spec.rb
index 58aabd913eb..c7840f26d8f 100644
--- a/spec/features/signup_spec.rb
+++ b/spec/features/signup_spec.rb
@@ -2,6 +2,8 @@ require 'spec_helper'
feature 'Signup', feature: true do
describe 'signup with no errors' do
+ before { allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(true) }
+
it 'creates the user account and sends a confirmation email' do
user = build(:user)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 10e7e693571..9581990666b 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -141,6 +141,7 @@ describe User, models: true do
end
describe '#confirm' do
+ before { allow(current_application_settings).to receive(:send_user_confirmation_email).and_return(true) }
let(:user) { create(:user, confirmed_at: nil, unconfirmed_email: 'test@gitlab.com') }
it 'returns unconfirmed' do