2017-04-18 20:09:07 +01:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Admin::InstancesController, type: :controller do
|
2017-04-28 14:12:37 +01:00
|
|
|
render_views
|
|
|
|
|
2017-04-18 20:09:07 +01:00
|
|
|
before do
|
|
|
|
sign_in Fabricate(:user, admin: true), scope: :user
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET #index' do
|
2017-05-29 17:12:17 +01:00
|
|
|
around do |example|
|
2020-12-14 08:06:34 +00:00
|
|
|
default_per_page = Instance.default_per_page
|
|
|
|
Instance.paginates_per 1
|
2017-05-29 17:12:17 +01:00
|
|
|
example.run
|
2020-12-14 08:06:34 +00:00
|
|
|
Instance.paginates_per default_per_page
|
2017-05-29 17:12:17 +01: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 20:09:07 +01:00
|
|
|
|
2018-04-21 20:35:07 +01:00
|
|
|
expect(response).to have_http_status(200)
|
2017-04-18 20:09:07 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|