Skip to content

Commit

Permalink
Remove changes from password spec
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermoap committed Oct 13, 2023
1 parent 7c488cd commit cbf70d3
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions spec/requests/api/v1/passwords/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,15 @@
subject { get edit_user_password_path, params: }

let(:user) { create(:user, password: 'mypass123') }
# We have to fix the raw token so this doesn't change in the docs
let(:raw) { '96BuszWmzDxRqXYzc_Mf' }
let(:key) { Devise.token_generator.send(:key_for, 'reset_password_token') }
let(:enc) { OpenSSL::HMAC.hexdigest('SHA256', key, raw) }
let(:password_token) { user.send(:set_reset_password_token) }
let(:params) do
{
reset_password_token: raw,
reset_password_token: password_token,
redirect_url: ENV.fetch('PASSWORD_RESET_URL', nil)
}
end

before do
# This is what Devise does behind the scenes in #set_reset_password_token
user.reset_password_token = enc
user.reset_password_sent_at = Time.current
user.save!(validate: false)
subject
end
before { subject }

it 'returns a the access token, uid and client id' do
expect(response.header['Location']).to include('token')
Expand Down

0 comments on commit cbf70d3

Please sign in to comment.