2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-20 23:36:14 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'user api keys integration' do
|
|
|
|
|
2019-05-07 11:12:20 +08:00
|
|
|
fab!(:user_api_key) { Fabricate(:readonly_user_api_key) }
|
2018-08-20 23:36:14 +08: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 14:28:01 +08:00
|
|
|
expect(user_api_key.reload.last_used_at).to eq_time(Time.zone.now)
|
2018-08-20 23:36:14 +08:00
|
|
|
end
|
|
|
|
end
|