0
0
Fork 0

Stop trying to shoehorn all Salmon updates into the poor database-connected

StreamEntry model. Simply render Salmon slaps as they are needed
This commit is contained in:
Eugen Rochko 2017-02-12 00:48:53 +01:00
parent 94d2182717
commit 0518492158
22 changed files with 304 additions and 266 deletions

View file

@ -6,40 +6,4 @@ RSpec.describe Favourite, type: :model do
let(:status) { Fabricate(:status, account: bob) }
subject { Favourite.new(account: alice, status: status) }
describe '#verb' do
it 'is always favorite' do
expect(subject.verb).to be :favorite
end
end
describe '#title' do
it 'describes the favourite' do
expect(subject.title).to eql 'alice favourited a status by bob'
end
end
describe '#content' do
it 'equals the title' do
expect(subject.content).to eq subject.title
end
end
describe '#object_type' do
it 'is an activity' do
expect(subject.object_type).to be :activity
end
end
describe '#target' do
it 'is the status that was favourited' do
expect(subject.target).to eq status
end
end
describe '#thread' do
it 'equals the target' do
expect(subject.thread).to eq subject.target
end
end
end

View file

@ -5,34 +5,4 @@ RSpec.describe Follow, type: :model do
let(:bob) { Fabricate(:account, username: 'bob') }
subject { Follow.new(account: alice, target_account: bob) }
describe '#verb' do
it 'is follow' do
expect(subject.verb).to be :follow
end
end
describe '#title' do
it 'describes the follow' do
expect(subject.title).to eql 'alice started following bob'
end
end
describe '#content' do
it 'is the same as the title' do
expect(subject.content).to eql subject.title
end
end
describe '#object_type' do
it 'is an activity' do
expect(subject.object_type).to be :activity
end
end
describe '#target' do
it 'is the person being followed' do
expect(subject.target).to eq bob
end
end
end

View file

@ -3,21 +3,11 @@ require 'rails_helper'
RSpec.describe StreamEntry, type: :model do
let(:alice) { Fabricate(:account, username: 'alice') }
let(:bob) { Fabricate(:account, username: 'bob') }
let(:follow) { Fabricate(:follow, account: alice, target_account: bob) }
let(:status) { Fabricate(:status, account: alice) }
let(:reblog) { Fabricate(:status, account: bob, reblog: status) }
let(:reply) { Fabricate(:status, account: bob, thread: status) }
let(:favourite) { Fabricate(:favourite, account: alice, status: status) }
describe '#targeted?' do
it 'returns true for a follow' do
expect(follow.stream_entry.targeted?).to be true
end
it 'returns true for a favourite' do
expect(favourite.stream_entry.targeted?).to be true
end
it 'returns true for a reblog' do
expect(reblog.stream_entry.targeted?).to be true
end
@ -28,10 +18,6 @@ RSpec.describe StreamEntry, type: :model do
end
describe '#threaded?' do
it 'returns true for a favourite' do
expect(favourite.stream_entry.threaded?).to be true
end
it 'returns true for a reply' do
expect(reply.stream_entry.threaded?).to be true
end