diff options
author | Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-05-30 01:12:17 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-29 18:12:17 +0200 |
commit | 7b92950f1c43ad009d169ce1792c9afed109b417 (patch) | |
tree | 4a10eb94296e07fee0e4ea81eecf7e76d8e21007 | |
parent | 97d7028c3137cb79d10e5b16034b3925808f5a86 (diff) |
Cover InstancesController more (#3342)
-rw-r--r-- | spec/controllers/admin/instances_controller_spec.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/controllers/admin/instances_controller_spec.rb b/spec/controllers/admin/instances_controller_spec.rb index 37fa8dd9a..f57e3fa97 100644 --- a/spec/controllers/admin/instances_controller_spec.rb +++ b/spec/controllers/admin/instances_controller_spec.rb @@ -8,8 +8,23 @@ RSpec.describe Admin::InstancesController, type: :controller do end describe 'GET #index' do - it 'returns http success' do - get :index + 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(:success) end |