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.

36 lines
933 B

  1. require 'rails_helper'
  2. describe Settings::FollowerDomainsController do
  3. render_views
  4. let(:user) { Fabricate(:user) }
  5. before do
  6. sign_in user, scope: :user
  7. end
  8. describe 'GET #show' do
  9. it 'returns http success' do
  10. get :show
  11. expect(response).to have_http_status(:success)
  12. end
  13. end
  14. describe 'PATCH #update' do
  15. let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com', salmon_url: 'http://example.com/salmon') }
  16. before do
  17. stub_request(:post, 'http://example.com/salmon').to_return(status: 200)
  18. poopfeast.follow!(user.account)
  19. patch :update, params: { select: ['example.com'] }
  20. end
  21. it 'redirects back to followers page' do
  22. expect(response).to redirect_to(settings_follower_domains_path)
  23. end
  24. it 'soft-blocks followers from selected domains' do
  25. expect(poopfeast.following?(user.account)).to be false
  26. end
  27. end
  28. end