spec/controllers/passwords_controller_spec.rb in authenticate-0.3.1 vs spec/controllers/passwords_controller_spec.rb in authenticate-0.3.2
- old
+ new
@@ -29,11 +29,11 @@
end
context 'with email that does not belong to an existing user' do
bad_email = 'bunk_email_address@non_existent_domain.com'
it 'does not send an email' do
ActionMailer::Base.deliveries.clear
- post :create, password: { email: bad_email}
+ post :create, password: { email: bad_email }
expect(ActionMailer::Base.deliveries).to be_empty
end
it 'always responds with redirect to avoid leaking user information' do
post :create, password: { email: bad_email }
expect(response).to be_redirect
@@ -62,11 +62,11 @@
context 'with a valid password_reset_token but invalid timestamp' do
it 'renders #new password form with notice' do
user = create(:user, :with_password_reset_token_and_timestamp, password_reset_sent_at: 2.years.ago)
get :edit, id: user.id, token: user.password_reset_token
expect(response).to be_redirect
- expect(flash[:notice]).to match /password change request has expired/
+ expect(flash[:notice]).to match(/password change request has expired/)
end
end
context 'with a blank password_reset_token' do
it 'renders #new password form with notice' do
user = create(:user)
@@ -102,18 +102,16 @@
user = create(:user, :with_password_reset_token_and_timestamp)
put :update, update_params(user, new_password: 'short')
expect(response).to render_template(:edit)
end
end
-
end
def update_params(user, options = {})
new_password = options.fetch(:new_password)
{
- id: user,
- token: user.password_reset_token,
- password_reset: { password: new_password }
+ id: user,
+ token: user.password_reset_token,
+ password_reset: { password: new_password }
}
end
-
end