2019-04-29 19:27:42 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-20 10:36:14 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'user api keys integration' do
|
|
|
|
|
2019-05-06 22:12:20 -05:00
|
|
|
fab!(:user_api_key) { Fabricate(:readonly_user_api_key) }
|
2018-08-20 10:36:14 -05:00
|
|
|
|
|
|
|
it 'updates last used time on use' do
|
|
|
|
user_api_key.update_columns(last_used_at: 7.days.ago)
|
|
|
|
|
|
|
|
freeze_time
|
|
|
|
get '/session/current.json', headers: {
|
|
|
|
HTTP_USER_API_KEY: user_api_key.key,
|
|
|
|
}
|
2019-03-28 01:28:01 -05:00
|
|
|
expect(user_api_key.reload.last_used_at).to eq_time(Time.zone.now)
|
2018-08-20 10:36:14 -05:00
|
|
|
end
|
|
|
|
end
|