The code powering m.abunchtell.com https://m.abunchtell.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

44 行
1.3 KiB

  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(:follow) { Fabricate(:follow, account: alice, target_account: bob) }
  6. let(:status) { Fabricate(:status, account: alice) }
  7. let(:reblog) { Fabricate(:status, account: bob, reblog: status) }
  8. let(:reply) { Fabricate(:status, account: bob, thread: status) }
  9. let(:favourite) { Fabricate(:favourite, account: alice, status: status) }
  10. describe '#targeted?' do
  11. it 'returns true for a follow' do
  12. expect(follow.stream_entry.targeted?).to be true
  13. end
  14. it 'returns true for a favourite' do
  15. expect(favourite.stream_entry.targeted?).to be true
  16. end
  17. it 'returns true for a reblog' do
  18. expect(reblog.stream_entry.targeted?).to be true
  19. end
  20. it 'returns false otherwise' do
  21. expect(status.stream_entry.targeted?).to be false
  22. end
  23. end
  24. describe '#threaded?' do
  25. it 'returns true for a favourite' do
  26. expect(favourite.stream_entry.threaded?).to be true
  27. end
  28. it 'returns true for a reply' do
  29. expect(reply.stream_entry.threaded?).to be true
  30. end
  31. it 'returns false otherwise' do
  32. expect(status.stream_entry.threaded?).to be false
  33. end
  34. end
  35. end