mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
DEV: Fix failing spec.
This commit is contained in:
parent
97dcd50e51
commit
d07605d885
@ -27,7 +27,7 @@ class UserBadge < ActiveRecord::Base
|
||||
private
|
||||
|
||||
def single_grant_badge?
|
||||
self.badge.single_grant?
|
||||
self.badge ? self.badge.single_grant? : true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ RSpec.describe Jobs::AutoExpireUserApiKeys do
|
||||
context 'when user api key is unused in last 1 days' do
|
||||
|
||||
before do
|
||||
SiteSetting.expire_user_api_keys_days = true
|
||||
SiteSetting.expire_user_api_keys_days = 1
|
||||
end
|
||||
|
||||
it 'should revoke the key' do
|
||||
@ -17,7 +17,7 @@ RSpec.describe Jobs::AutoExpireUserApiKeys do
|
||||
|
||||
described_class.new.execute({})
|
||||
|
||||
expect(key1.reload.revoked_at).to eq(Time.zone.now)
|
||||
expect(key1.reload.revoked_at).to be_within(1.second).of(Time.zone.now)
|
||||
expect(key2.reload.revoked_at).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,9 @@ require_dependency 'user_badge'
|
||||
describe UserBadge do
|
||||
|
||||
context 'validations' do
|
||||
before(:each) { BadgeGranter.grant(Fabricate(:badge), Fabricate(:user)) }
|
||||
let(:badge) { Fabricate(:badge) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:subject) { BadgeGranter.grant(badge, user) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:badge_id) }
|
||||
it { is_expected.to validate_presence_of(:user_id) }
|
||||
|
Loading…
Reference in New Issue
Block a user