diff options
Diffstat (limited to 'spec/controllers/settings/follower_domains_controller_spec.rb')
-rw-r--r-- | spec/controllers/settings/follower_domains_controller_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/controllers/settings/follower_domains_controller_spec.rb b/spec/controllers/settings/follower_domains_controller_spec.rb new file mode 100644 index 000000000..1afdb9757 --- /dev/null +++ b/spec/controllers/settings/follower_domains_controller_spec.rb @@ -0,0 +1,34 @@ +require 'rails_helper' + +describe Settings::FollowerDomainsController do + let(:user) { Fabricate(:user) } + + before do + sign_in user, scope: :user + end + + describe 'GET #show' do + it 'returns http success' do + get :show + expect(response).to have_http_status(:success) + end + end + + describe 'PATCH #update' do + let(:poopfeast) { Fabricate(:account, username: 'poopfeast', domain: 'example.com', salmon_url: 'http://example.com/salmon') } + + before do + stub_request(:post, 'http://example.com/salmon').to_return(status: 200) + poopfeast.follow!(user.account) + patch :update, params: { select: ['example.com'] } + end + + it 'redirects back to followers page' do + expect(response).to redirect_to(settings_follower_domains_path) + end + + it 'soft-blocks followers from selected domains' do + expect(poopfeast.following?(user.account)).to be false + end + end +end |