闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
787 B

  1. require 'rails_helper'
  2. describe AccountUnfollowController do
  3. render_views
  4. let(:user) { Fabricate(:user) }
  5. let(:alice) { Fabricate(:account, username: 'alice') }
  6. describe 'POST #create' do
  7. let(:service) { double }
  8. subject { post :create, params: { account_username: alice.username } }
  9. before do
  10. allow(UnfollowService).to receive(:new).and_return(service)
  11. allow(service).to receive(:call)
  12. end
  13. it 'does not create for user who is not signed in' do
  14. subject
  15. expect(UnfollowService).not_to receive(:new)
  16. end
  17. it 'redirects to account path' do
  18. sign_in(user)
  19. subject
  20. expect(service).to have_received(:call).with(user.account, alice)
  21. expect(response).to redirect_to(account_path(alice))
  22. end
  23. end
  24. end