闭社主体 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.

24 lines
623 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. before do
  8. sign_in(user)
  9. end
  10. it 'redirects to account path' do
  11. service = double
  12. allow(UnfollowService).to receive(:new).and_return(service)
  13. allow(service).to receive(:call)
  14. post :create, params: { account_username: alice.username }
  15. expect(service).to have_received(:call).with(user.account, alice)
  16. expect(response).to redirect_to(account_path(alice))
  17. end
  18. end
  19. end