about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--spec/controllers/admin/instances_controller_spec.rb19
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