From e85b8af05183d1048adc4a39bc3d975af153463d Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Thu, 9 May 2019 09:40:09 -0500 Subject: Second round of Rspec fixes. --- spec/lib/activitypub/activity/create_spec.rb | 3 ++- spec/lib/activitypub/activity/delete_spec.rb | 2 +- spec/lib/activitypub/activity/move_spec.rb | 4 ++-- spec/lib/feed_manager_spec.rb | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'spec/lib') diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 412609de4..d539a97ea 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' RSpec.describe ActivityPub::Activity::Create do - let(:sender) { Fabricate(:account, followers_url: 'http://example.com/followers', domain: 'example.com', uri: 'https://example.com/actor') } + let(:sender) { Fabricate(:account, followers_url: 'http://example.com/followers', domain: 'example.com', uri: 'https://example.com/actor', inbox_url: 'https://example.com/inbox') } let(:json) do { @@ -18,6 +18,7 @@ RSpec.describe ActivityPub::Activity::Create do stub_request(:get, 'http://example.com/attachment.png').to_return(request_fixture('avatar.txt')) stub_request(:get, 'http://example.com/emoji.png').to_return(body: attachment_fixture('emojo.png')) + stub_request(:post, 'https://example.com/inbox') end describe '#perform' do diff --git a/spec/lib/activitypub/activity/delete_spec.rb b/spec/lib/activitypub/activity/delete_spec.rb index 37b93ecf7..c62962352 100644 --- a/spec/lib/activitypub/activity/delete_spec.rb +++ b/spec/lib/activitypub/activity/delete_spec.rb @@ -31,7 +31,7 @@ RSpec.describe ActivityPub::Activity::Delete do describe '#perform' do subject { described_class.new(json, sender) } let!(:reblogger) { Fabricate(:account) } - let!(:follower) { Fabricate(:account, username: 'follower', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox') } + let!(:follower) { Fabricate(:account, username: 'follower', domain: 'example.com', inbox_url: 'http://example.com/inbox') } let!(:reblog) { Fabricate(:status, account: reblogger, reblog: status) } before do diff --git a/spec/lib/activitypub/activity/move_spec.rb b/spec/lib/activitypub/activity/move_spec.rb index 3574f273a..8b5121e9e 100644 --- a/spec/lib/activitypub/activity/move_spec.rb +++ b/spec/lib/activitypub/activity/move_spec.rb @@ -8,8 +8,8 @@ RSpec.describe ActivityPub::Activity::Move do before do follower.follow!(old_account) - old_account.update!(uri: 'https://example.org/alice', domain: 'example.org', protocol: :activitypub, inbox_url: 'https://example.org/inbox') - new_account.update!(uri: 'https://example.com/alice', domain: 'example.com', protocol: :activitypub, inbox_url: 'https://example.com/inbox', also_known_as: [old_account.uri]) + old_account.update!(uri: 'https://example.org/alice', domain: 'example.org', inbox_url: 'https://example.org/inbox') + new_account.update!(uri: 'https://example.com/alice', domain: 'example.com', inbox_url: 'https://example.com/inbox', also_known_as: [old_account.uri]) stub_request(:post, 'https://example.org/inbox').to_return(status: 200) stub_request(:post, 'https://example.com/inbox').to_return(status: 200) diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb index 13850f807..9ef256764 100644 --- a/spec/lib/feed_manager_spec.rb +++ b/spec/lib/feed_manager_spec.rb @@ -22,9 +22,13 @@ RSpec.describe FeedManager do describe '#filter?' do let(:alice) { Fabricate(:account, username: 'alice') } - let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') } + let(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com', inbox_url: 'https://example.com/inbox') } let(:jeff) { Fabricate(:account, username: 'jeff') } + before do + stub_request(:post, bob.inbox_url) + end + context 'for home feed' do it 'returns false for followee\'s status' do status = Fabricate(:status, text: 'Hello world', account: alice) -- cgit