about summary refs log tree commit diff
path: root/spec/models/favourite_spec.rb
blob: cc3d604d6035a5a35fc3bd83df0d54b470e204b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'rails_helper'

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

  subject { Favourite.new(account: alice, status: status) }

  describe '#verb' do
    it 'is always favorite' do
      expect(subject.verb).to be :favorite
    end
  end

  describe '#title' do
    it 'describes the favourite' do
      expect(subject.title).to eql 'alice favourited a status by bob'
    end
  end

  describe '#content' do
    it 'equals the title' do
      expect(subject.content).to eq subject.title
    end
  end

  describe '#object_type' do
    it 'is an activity' do
      expect(subject.object_type).to be :activity
    end
  end

  describe '#target' do
    it 'is the status that was favourited' do
      expect(subject.target).to eq status
    end
  end

  describe '#thread' do
    it 'equals the target' do
      expect(subject.thread).to eq subject.target
    end
  end
end