about summary refs log tree commit diff
path: root/spec/models/concerns/streamable_spec.rb
blob: b5f2d51923e95b3dc863541e30b64397862a9974 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Streamable do
  class Parent
    def title; end

    def target; end

    def thread; end

    def self.has_one(*); end

    def self.after_create; end
  end

  class Child < Parent
    include Streamable
  end

  child = Child.new

  describe '#title' do
    it 'calls Parent#title' do
      expect_any_instance_of(Parent).to receive(:title)
      child.title
    end
  end

  describe '#content' do
    it 'calls #title' do
      expect_any_instance_of(Parent).to receive(:title)
      child.content
    end
  end

  describe '#target' do
    it 'calls Parent#target' do
      expect_any_instance_of(Parent).to receive(:target)
      child.target
    end
  end

  describe '#object_type' do
    it 'returns :activity' do
      expect(child.object_type).to eq :activity
    end
  end

  describe '#thread' do
    it 'calls Parent#thread' do
      expect_any_instance_of(Parent).to receive(:thread)
      child.thread
    end
  end

  describe '#hidden?' do
    it 'returns false' do
      expect(child.hidden?).to be false
    end
  end
end