闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
501 B

  1. require 'rails_helper'
  2. RSpec.describe Subscription, type: :model do
  3. let(:alice) { Fabricate(:account, username: 'alice') }
  4. subject { Fabricate(:subscription, account: alice) }
  5. describe '#expired?' do
  6. it 'return true when expires_at is past' do
  7. subject.expires_at = 2.days.ago
  8. expect(subject.expired?).to be true
  9. end
  10. it 'return false when expires_at is future' do
  11. subject.expires_at = 2.days.from_now
  12. expect(subject.expired?).to be false
  13. end
  14. end
  15. end