闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
799 B

  1. require 'rails_helper'
  2. RSpec.describe Admin::InstancesController, type: :controller do
  3. render_views
  4. before do
  5. sign_in Fabricate(:user, admin: true), scope: :user
  6. end
  7. describe 'GET #index' do
  8. around do |example|
  9. default_per_page = Account.default_per_page
  10. Account.paginates_per 1
  11. example.run
  12. Account.paginates_per default_per_page
  13. end
  14. it 'renders instances' do
  15. Fabricate(:account, domain: 'popular')
  16. Fabricate(:account, domain: 'popular')
  17. Fabricate(:account, domain: 'less.popular')
  18. get :index, params: { page: 2 }
  19. instances = assigns(:instances).to_a
  20. expect(instances.size).to eq 1
  21. expect(instances[0].domain).to eq 'less.popular'
  22. expect(response).to have_http_status(:success)
  23. end
  24. end
  25. end