2017-04-18 12:09:07 -07:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Admin::InstancesController, type: :controller do
|
2017-04-28 06:12:37 -07:00
|
|
|
render_views
|
|
|
|
|
2017-04-18 12:09:07 -07:00
|
|
|
before do
|
|
|
|
sign_in Fabricate(:user, admin: true), scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET #index' do
|
2017-05-29 09:12:17 -07:00
|
|
|
around do |example|
|
2020-12-14 00:06:34 -08:00
|
|
|
default_per_page = Instance.default_per_page
|
|
|
|
Instance.paginates_per 1
|
2017-05-29 09:12:17 -07:00
|
|
|
example.run
|
2020-12-14 00:06:34 -08:00
|
|
|
Instance.paginates_per default_per_page
|
2017-05-29 09:12:17 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders instances' do
|
|
|
|
Fabricate(:account, domain: 'popular')
|
|
|
|
Fabricate(:account, domain: 'popular')
|
|
|
|
Fabricate(:account, domain: 'less.popular')
|
|
|
|
|
|
|
|
get :index, params: { page: 2 }
|
|
|
|
|
|
|
|
instances = assigns(:instances).to_a
|
|
|
|
expect(instances.size).to eq 1
|
|
|
|
expect(instances[0].domain).to eq 'less.popular'
|
2017-04-18 12:09:07 -07:00
|
|
|
|
2018-04-21 12:35:07 -07:00
|
|
|
expect(response).to have_http_status(200)
|
2017-04-18 12:09:07 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|