Fix the build

This commit is contained in:
Arpit Jalan 2017-04-18 16:34:21 +05:30
parent 1c23aedccf
commit f968b4e662
2 changed files with 13 additions and 27 deletions

View File

@ -243,8 +243,21 @@ describe InvitesController do
xhr :put, :perform_accept_invitation, id: invite.invite_key, format: :json
end
it "does not send password reset email if sso is enabled" do
SiteSetting.enable_sso = true
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
xhr :put, :perform_accept_invitation, id: invite.invite_key, format: :json
end
it "does not send password reset email if local login is disabled" do
SiteSetting.enable_local_logins = false
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
xhr :put, :perform_accept_invitation, id: invite.invite_key, format: :json
end
it 'sends an activation email if password is set' do
user.password_hash = 'qaw3ni3h2wyr63lakw7pea1nrtr44pls'
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
Jobs.expects(:enqueue).with(:critical_user_email, has_entries(type: :signup, user_id: user.id))
xhr :put, :perform_accept_invitation, id: invite.invite_key, format: :json
end

View File

@ -213,33 +213,6 @@ describe Invite do
end
context 'enqueues a job to email "set password" instructions' do
it 'does not enqueue an email if sso is enabled' do
SiteSetting.stubs(:enable_sso).returns(true)
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
invite.redeem
end
it 'does not enqueue an email if local login is disabled' do
SiteSetting.stubs(:enable_local_logins).returns(false)
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
invite.redeem
end
it 'does not enqueue an email if the user has already set password' do
Fabricate(:user, email: invite.email, password_hash: "7af7805c9ee3697ed1a83d5e3cb5a3a431d140933a87fdcdc5a42aeef9337f81")
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username)).never
invite.redeem
end
it 'enqueues an email if all conditions are satisfied' do
Jobs.expects(:enqueue).with(:invite_password_instructions_email, has_key(:username))
invite.redeem
end
end
context "as a moderator" do
it "will give the user a moderator flag" do
invite.invited_by = Fabricate(:admin)