Revert "Notify admins when a approval/invite user signs up"

This reverts commit 251d85d88a.
This commit is contained in:
shawn-higgins1
2019-05-21 14:37:27 -04:00
parent 251d85d88a
commit 0360c78219
12 changed files with 2 additions and 270 deletions

View File

@ -223,34 +223,6 @@ describe SessionsController, type: :controller do
expect(response).to redirect_to(root_path)
end
context 'registration notification emails' do
before do
allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
@user = create(:user, provider: "greenlight")
@admin = create(:user, provider: "greenlight", email: "test@example.com")
@admin.add_role :admin
end
it "should notify admin on new user signup with approve/reject registration" do
allow_any_instance_of(Registrar).to receive(:approval_registration).and_return(true)
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:bn_launcher]
expect { get :omniauth, params: { provider: 'bn_launcher' } }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
it "should notify admin on new user signup with invite registration" do
allow_any_instance_of(Registrar).to receive(:invite_registration).and_return(true)
invite = Invitation.create(email: "user@google.com", provider: "greenlight")
@request.session[:invite_token] = invite.invite_token
request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:bn_launcher]
expect { get :omniauth, params: { provider: 'bn_launcher' } }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
end
end
it "should not create session without omniauth env set for bn_launcher" do

View File

@ -186,17 +186,6 @@ describe UsersController, type: :controller do
before do
allow_any_instance_of(Registrar).to receive(:invite_registration).and_return(true)
allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
@user = create(:user, provider: "greenlight")
@admin = create(:user, provider: "greenlight", email: "test@example.com")
@admin.add_role :admin
end
it "should notify admins that user signed up" do
params = random_valid_user_params
invite = Invitation.create(email: params[:user][:email], provider: "greenlight")
@request.session[:invite_token] = invite.invite_token
expect { post :create, params: params }.to change { ActionMailer::Base.deliveries.count }.by(1)
end
it "rejects the user if they are not invited" do
@ -251,9 +240,6 @@ describe UsersController, type: :controller do
before do
allow_any_instance_of(Registrar).to receive(:approval_registration).and_return(true)
allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
@user = create(:user, provider: "greenlight")
@admin = create(:user, provider: "greenlight", email: "test@example.com")
@admin.add_role :admin
end
it "allows any user to sign up" do
@ -279,14 +265,6 @@ describe UsersController, type: :controller do
expect(u.has_role?(:pending)).to eq(true)
end
it "notifies admins that a user signed up" do
allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
params = random_valid_user_params
expect { post :create, params: params }.to change { ActionMailer::Base.deliveries.count }.by(2)
end
end
end