From 11ff92c9d7b27c2c9ed86f649aef8d956cc8b989 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 28 Feb 2016 21:22:56 +0100 Subject: Adding a test for ReblogService, fixing mentions for remote statuses --- spec/services/reblog_service_spec.rb | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'spec/services') diff --git a/spec/services/reblog_service_spec.rb b/spec/services/reblog_service_spec.rb index 4e94d5a70..f12fdb837 100644 --- a/spec/services/reblog_service_spec.rb +++ b/spec/services/reblog_service_spec.rb @@ -1,5 +1,30 @@ require 'rails_helper' RSpec.describe ReblogService do - pending + let(:alice) { Fabricate(:account, username: 'alice') } + let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com') } + let(:status) { Fabricate(:status, account: bob, uri: 'tag:example.com;something:something') } + + subject { ReblogService.new } + + before do + stub_const('HUB_URL', 'http://hub.example.com') + + stub_request(:post, 'http://hub.example.com') + stub_request(:post, 'http://salmon.example.com') + + subject.(alice, status) + end + + it 'creates a reblog' do + expect(status.reblogs.count).to eq 1 + end + + it 'pings PubSubHubbub hubs' do + expect(a_request(:post, 'http://hub.example.com')).to have_been_made + end + + it 'sends a Salmon slap for a remote reblog' do + expect(a_request(:post, 'http://salmon.example.com')).to have_been_made + end end -- cgit