instances_controller_spec.rb 794 B

1234567891011121314151617181920212223242526272829303132
  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(200)
  23. end
  24. end
  25. end