mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 01:33:43 +08:00
e219588142
* Introduced fab!, a helper that creates database state for a group It's almost identical to let_it_be, except: 1. It creates a new object for each test by default, 2. You can disable it using PREFABRICATION=0
19 lines
446 B
Ruby
19 lines
446 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe 'user api keys integration' do
|
|
|
|
fab!(: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,
|
|
}
|
|
expect(user_api_key.reload.last_used_at).to eq_time(Time.zone.now)
|
|
end
|
|
end
|