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