forked from fedi/mastodon
c347327d54
* Spec output of Settings::Exports::BlockedAccountsController * Spec output of Settings::Exports::FollowingAccountsController * Spec output of Settings::Exports::MutedAccountsController * Spec Settings::Exports::BaseController This commit removes duplicate specs in classes inheriting Settings::Exports::BaseController as well.
30 lines
777 B
Ruby
30 lines
777 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Settings::Exports::BaseController do
|
|
controller do
|
|
def export_data
|
|
@export.account.username
|
|
end
|
|
end
|
|
|
|
describe 'GET #index' do
|
|
it 'returns a csv of the exported data when signed in' do
|
|
user = Fabricate(:user)
|
|
sign_in user
|
|
get :index, format: :csv
|
|
|
|
expect(response).to have_http_status(:success)
|
|
expect(response.content_type).to eq 'text/csv'
|
|
expect(response.headers['Content-Disposition']).to eq 'attachment; filename="base.csv"'
|
|
expect(response.body).to eq user.account.username
|
|
end
|
|
|
|
it 'returns unauthorized when not signed in' do
|
|
get :index, format: :csv
|
|
expect(response).to have_http_status(:unauthorized)
|
|
end
|
|
end
|
|
end
|