about summary refs log tree commit diff
path: root/spec/models/subscription_spec.rb
blob: 11fd8fadc860072039834a4240aced9cb780bca2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'rails_helper'

RSpec.describe Subscription, type: :model do
  let(:alice) { Fabricate(:account, username: 'alice') }

  subject { Fabricate(:subscription, account: alice) }

  describe '#expired?' do
    it 'return true when expires_at is past' do
      subject.expires_at = 2.days.ago
      expect(subject.expired?).to be true
    end

    it 'return false when expires_at is future' do
      subject.expires_at = 2.days.from_now
      expect(subject.expired?).to be false
    end
  end
end