follower_domains_controller_spec.rb 933 B

123456789101112131415161718192021222324252627282930313233343536
  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