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
43
spec/requests/settings/exports/muted_accounts_spec.rb
Normal file
43
spec/requests/settings/exports/muted_accounts_spec.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe 'Settings / Exports / Muted Accounts' do
|
||||
describe 'GET /settings/exports/mutes' do
|
||||
context 'with a signed in user who has muted accounts' do
|
||||
let(:user) { Fabricate :user }
|
||||
|
||||
before do
|
||||
Fabricate(
|
||||
:mute,
|
||||
account: user.account,
|
||||
target_account: Fabricate(:account, username: 'username', domain: 'domain')
|
||||
)
|
||||
sign_in user
|
||||
end
|
||||
|
||||
it 'returns a CSV with the muted accounts' do
|
||||
get '/settings/exports/mutes.csv'
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(200)
|
||||
expect(response.content_type)
|
||||
.to eq('text/csv')
|
||||
expect(response.body)
|
||||
.to eq(<<~CSV)
|
||||
Account address,Hide notifications
|
||||
username@domain,true
|
||||
CSV
|
||||
end
|
||||
end
|
||||
|
||||
describe 'when signed out' do
|
||||
it 'returns unauthorized' do
|
||||
get '/settings/exports/mutes.csv'
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(401)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue