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|
|
|
|
|
default_per_page = Account.default_per_page
|
|
|
|
Account.paginates_per 1
|
|
|
|
example.run
|
|
|
|
Account.paginates_per default_per_page
|
|
|
|
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
|