about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-11-25 05:17:15 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-11-25 05:17:15 +0000
commit86f4f8e158deb57b2672d961f7c2dfc963e2a50c (patch)
treeeb0c60264b8885e3bce2c6a8322c3f800071c189 /spec/models
parent167fe2ab08288ce286f5c7660ff0ed587b65b988 (diff)
parent662b8eefe891c050e6befcb5736a9a5c417014b7 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/streamable_spec.rb63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/models/concerns/streamable_spec.rb b/spec/models/concerns/streamable_spec.rb
new file mode 100644
index 000000000..b5f2d5192
--- /dev/null
+++ b/spec/models/concerns/streamable_spec.rb
@@ -0,0 +1,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