blob: 412b814439bc0f52d49f1b4f767ea3ec64b08af0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
require 'rails_helper'
RSpec.describe Admin::InstancesController, type: :controller do
render_views
before do
sign_in Fabricate(:user, admin: true), scope: :user
end
describe 'GET #index' do
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'
expect(response).to have_http_status(200)
end
end
end
|