瀏覽代碼

Implement tests for Account#possibly_stale? (#5591)

master
ysksn 6 年之前
committed by Yamagishi Kazutoshi
父節點
當前提交
15c0f6ae56
共有 1 個文件被更改,包括 28 次插入0 次删除
  1. +28
    -0
      spec/models/account_spec.rb

+ 28
- 0
spec/models/account_spec.rb 查看文件

@@ -123,6 +123,34 @@ RSpec.describe Account, type: :model do
end
end

describe '#possibly_stale?' do
let(:account) { Fabricate(:account, last_webfingered_at: last_webfingered_at) }

context 'last_webfingered_at is nil' do
let(:last_webfingered_at) { nil }

it 'returns true' do
expect(account.possibly_stale?).to be true
end
end

context 'last_webfingered_at is more than 24 hours before' do
let(:last_webfingered_at) { 25.hours.ago }

it 'returns true' do
expect(account.possibly_stale?).to be true
end
end

context 'last_webfingered_at is less than 24 hours before' do
let(:last_webfingered_at) { 23.hours.ago }

it 'returns false' do
expect(account.possibly_stale?).to be false
end
end
end

describe '#to_param' do
it 'returns username' do
account = Fabricate(:account, username: 'alice')


Loading…
取消
儲存