Convert "CSV export" settings controller specs to request specs (#31601)
This commit is contained in:
parent
38a3466741
commit
a7f8417795
12 changed files with 252 additions and 122 deletions
39
spec/requests/settings/exports/blocked_domains_spec.rb
Normal file
39
spec/requests/settings/exports/blocked_domains_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Settings / Exports / Blocked Domains' do
|
||||
describe 'GET /settings/exports/domain_blocks' do
|
||||
context 'with a signed in user who has blocked domains' do
|
||||
let(:account) { Fabricate :account, domain: 'example.com' }
|
||||
let(:user) { Fabricate :user, account: account }
|
||||
|
||||
before do
|
||||
Fabricate(:account_domain_block, domain: 'example.com', account: account)
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns a CSV with the domains' do
|
||||
get '/settings/exports/domain_blocks.csv'
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to eq('text/csv')
|
||||
expect(response.body)
|
||||
.to eq(<<~CSV)
|
||||
example.com
|
||||
CSV
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when signed out' do
|
||||
it 'returns unauthorized' do
|
||||
get '/settings/exports/domain_blocks.csv'
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(401)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue