streamable_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Streamable do
  4. class Parent
  5. def title; end
  6. def target; end
  7. def thread; end
  8. def self.has_one(*); end
  9. def self.after_create; end
  10. end
  11. class Child < Parent
  12. include Streamable
  13. end
  14. child = Child.new
  15. describe '#title' do
  16. it 'calls Parent#title' do
  17. expect_any_instance_of(Parent).to receive(:title)
  18. child.title
  19. end
  20. end
  21. describe '#content' do
  22. it 'calls #title' do
  23. expect_any_instance_of(Parent).to receive(:title)
  24. child.content
  25. end
  26. end
  27. describe '#target' do
  28. it 'calls Parent#target' do
  29. expect_any_instance_of(Parent).to receive(:target)
  30. child.target
  31. end
  32. end
  33. describe '#object_type' do
  34. it 'returns :activity' do
  35. expect(child.object_type).to eq :activity
  36. end
  37. end
  38. describe '#thread' do
  39. it 'calls Parent#thread' do
  40. expect_any_instance_of(Parent).to receive(:thread)
  41. child.thread
  42. end
  43. end
  44. describe '#hidden?' do
  45. it 'returns false' do
  46. expect(child.hidden?).to be false
  47. end
  48. end
  49. end