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/controllers/admin/accounts_controller_spec.rb | 38 ---------------------- spec/controllers/api/v1/follows_controller_spec.rb | 8 ----- .../concerns/account_controller_concern_spec.rb | 2 +- spec/controllers/relationships_controller_spec.rb | 4 +-- .../remote_unfollows_controller_spec.rb | 2 +- 5 files changed, 4 insertions(+), 50 deletions(-) (limited to 'spec/controllers') diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index a348ab3d7..608606ff9 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -75,44 +75,6 @@ RSpec.describe Admin::AccountsController, type: :controller do end end - describe 'POST #subscribe' do - subject { post :subscribe, params: { id: account.id } } - - let(:current_user) { Fabricate(:user, admin: admin) } - let(:account) { Fabricate(:account) } - - context 'when user is admin' do - let(:admin) { true } - - it { is_expected.to redirect_to admin_account_path(account.id) } - end - - context 'when user is not admin' do - let(:admin) { false } - - it { is_expected.to have_http_status :forbidden } - end - end - - describe 'POST #unsubscribe' do - subject { post :unsubscribe, params: { id: account.id } } - - let(:current_user) { Fabricate(:user, admin: admin) } - let(:account) { Fabricate(:account) } - - context 'when user is admin' do - let(:admin) { true } - - it { is_expected.to redirect_to admin_account_path(account.id) } - end - - context 'when user is not admin' do - let(:admin) { false } - - it { is_expected.to have_http_status :forbidden } - end - end - describe 'POST #memorialize' do subject { post :memorialize, params: { id: account.id } } diff --git a/spec/controllers/api/v1/follows_controller_spec.rb b/spec/controllers/api/v1/follows_controller_spec.rb index 089e0fe5e..df335cc5d 100644 --- a/spec/controllers/api/v1/follows_controller_spec.rb +++ b/spec/controllers/api/v1/follows_controller_spec.rb @@ -35,14 +35,6 @@ RSpec.describe Api::V1::FollowsController, type: :controller do expect(user.account.following?(Account.find_by(username: 'gargron', domain: 'quitter.no'))).to be true end - it 'sends a salmon slap to the remote user' do - expect(a_request(:post, "https://quitter.no/main/salmon/user/7477")).to have_been_made - end - - it 'subscribes to remote hub' do - expect(a_request(:post, "https://quitter.no/main/push/hub")).to have_been_made - end - it 'returns http success if already following, too' do post :create, params: { uri: 'gargron@quitter.no' } expect(response).to have_http_status(200) diff --git a/spec/controllers/concerns/account_controller_concern_spec.rb b/spec/controllers/concerns/account_controller_concern_spec.rb index ea2b4a2a1..6c58ca559 100644 --- a/spec/controllers/concerns/account_controller_concern_spec.rb +++ b/spec/controllers/concerns/account_controller_concern_spec.rb @@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do it 'sets link headers' do account = Fabricate(:account, username: 'username', user: Fabricate(:user)) get 'success', params: { account_username: 'username' } - expect(response.headers['Link'].to_s).to eq '; rel="lrdd"; type="application/xrd+xml", ; rel="alternate"; type="application/atom+xml", ; rel="alternate"; type="application/activity+json"' + expect(response.headers['Link'].to_s).to eq '; rel="lrdd"; type="application/xrd+xml", ; rel="alternate"; type="application/activity+json"' end it 'returns http success' do diff --git a/spec/controllers/relationships_controller_spec.rb b/spec/controllers/relationships_controller_spec.rb index 16e255afe..ea667a3f2 100644 --- a/spec/controllers/relationships_controller_spec.rb +++ b/spec/controllers/relationships_controller_spec.rb @@ -36,10 +36,10 @@ describe RelationshipsController do end describe 'PATCH #update' do - let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com', salmon_url: 'http://example.com/salmon') } + let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com', inbox_url: 'http://example.com/inbox') } before do - stub_request(:post, 'http://example.com/salmon').to_return(status: 200) + stub_request(:post, 'http://example.com/inbox').to_return(status: 200) end shared_examples 'redirects back to followers page' do diff --git a/spec/controllers/remote_unfollows_controller_spec.rb b/spec/controllers/remote_unfollows_controller_spec.rb index a1a55ede0..e2f3fe4cb 100644 --- a/spec/controllers/remote_unfollows_controller_spec.rb +++ b/spec/controllers/remote_unfollows_controller_spec.rb @@ -10,7 +10,7 @@ describe RemoteUnfollowsController do let(:current_user) { Fabricate(:user, account: current_account) } let(:current_account) { Fabricate(:account) } - let(:remote_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', protocol: :activitypub, domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } + let(:remote_account) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', inbox_url: 'http://example.com/inbox')).account } before do sign_in current_user current_account.follow!(remote_account) -- cgit