reveal API key with user password

This commit is contained in:
Alex Turchyn
2025-09-05 09:29:20 +03:00
committed by Pete Matsyburka
parent c04bb2d7cf
commit f40f1d25de
7 changed files with 93 additions and 4 deletions
+22
View File
@@ -14,4 +14,26 @@ RSpec.describe 'API Settings' do
token = user.access_token.token
expect(page).to have_field('X-Auth-Token', with: token.sub(token[5..], '*' * token[5..].size))
end
it 'reveals API key with correct password' do
find('#api_key').click
within('.modal') do
fill_in 'password', with: user.password
click_button 'Submit'
end
expect(page).to have_field('X-Auth-Token', with: user.access_token.token)
end
it 'shows error with incorrect password' do
find('#api_key').click
within('.modal') do
fill_in 'password', with: 'wrong_password'
click_button 'Submit'
end
expect(page).to have_content('Wrong password')
end
end