闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
861 B

  1. require 'rails_helper'
  2. RSpec.describe StreamEntry, type: :model do
  3. let(:alice) { Fabricate(:account, username: 'alice') }
  4. let(:bob) { Fabricate(:account, username: 'bob') }
  5. let(:status) { Fabricate(:status, account: alice) }
  6. let(:reblog) { Fabricate(:status, account: bob, reblog: status) }
  7. let(:reply) { Fabricate(:status, account: bob, thread: status) }
  8. describe '#targeted?' do
  9. it 'returns true for a reblog' do
  10. expect(reblog.stream_entry.targeted?).to be true
  11. end
  12. it 'returns false otherwise' do
  13. expect(status.stream_entry.targeted?).to be false
  14. end
  15. end
  16. describe '#threaded?' do
  17. it 'returns true for a reply' do
  18. expect(reply.stream_entry.threaded?).to be true
  19. end
  20. it 'returns false otherwise' do
  21. expect(status.stream_entry.threaded?).to be false
  22. end
  23. end
  24. end