2016-02-25 10:17:01 +11:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe StreamEntry, type: :model do
|
2016-02-27 01:28:08 +11:00
|
|
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
|
|
|
let(:bob) { Fabricate(:account, username: 'bob') }
|
|
|
|
let(:status) { Fabricate(:status, account: alice) }
|
|
|
|
let(:reblog) { Fabricate(:status, account: bob, reblog: status) }
|
|
|
|
let(:reply) { Fabricate(:status, account: bob, thread: status) }
|
|
|
|
|
2016-02-25 10:17:01 +11:00
|
|
|
describe '#targeted?' do
|
2016-02-27 01:28:08 +11:00
|
|
|
it 'returns true for a reblog' do
|
|
|
|
expect(reblog.stream_entry.targeted?).to be true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false otherwise' do
|
|
|
|
expect(status.stream_entry.targeted?).to be false
|
|
|
|
end
|
2016-02-25 10:17:01 +11:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#threaded?' do
|
2016-02-27 01:28:08 +11:00
|
|
|
it 'returns true for a reply' do
|
|
|
|
expect(reply.stream_entry.threaded?).to be true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false otherwise' do
|
|
|
|
expect(status.stream_entry.threaded?).to be false
|
|
|
|
end
|
2016-02-25 10:17:01 +11:00
|
|
|
end
|
|
|
|
end
|