about summary refs log tree commit diff
path: root/spec/controllers/admin
diff options
context:
space:
mode:
authorJeong Arm <kjwonmail@gmail.com>2021-11-27 06:12:27 +0900
committerGitHub <noreply@github.com>2021-11-26 22:12:27 +0100
commit1c826471e7d964f0fdb2dc2b89dcd5a19c017538 (patch)
tree0b8ed29d7c23813504d15af05db2e341ba206d44 /spec/controllers/admin
parent3f382e337d5c40db18995a88c0bf6b1b34f031b7 (diff)
Fix admin statuses order(#16937) (#16969)
* Fix #16937

* Add test for statuses order
Diffstat (limited to 'spec/controllers/admin')
-rw-r--r--spec/controllers/admin/statuses_controller_spec.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb
index d9690d83f..e388caae2 100644
--- a/spec/controllers/admin/statuses_controller_spec.rb
+++ b/spec/controllers/admin/statuses_controller_spec.rb
@@ -8,6 +8,9 @@ describe Admin::StatusesController do
   let!(:status) { Fabricate(:status, account: account) }
   let(:media_attached_status) { Fabricate(:status, account: account, sensitive: !sensitive) }
   let!(:media_attachment) { Fabricate(:media_attachment, account: account, status: media_attached_status) }
+  let(:last_media_attached_status) { Fabricate(:status, account: account, sensitive: !sensitive) }
+  let!(:last_media_attachment) { Fabricate(:media_attachment, account: account, status: last_media_attached_status) }
+  let!(:last_status) { Fabricate(:status, account: account) }
   let(:sensitive) { true }
 
   before do
@@ -19,7 +22,8 @@ describe Admin::StatusesController do
       get :index, params: { account_id: account.id }
 
       statuses = assigns(:statuses).to_a
-      expect(statuses.size).to eq 2
+      expect(statuses.size).to eq 4
+      expect(statuses.first.id).to eq last_status.id
       expect(response).to have_http_status(200)
     end
 
@@ -27,7 +31,8 @@ describe Admin::StatusesController do
       get :index, params: { account_id: account.id, media: true }
 
       statuses = assigns(:statuses).to_a
-      expect(statuses.size).to eq 1
+      expect(statuses.size).to eq 2
+      expect(statuses.first.id).to eq last_media_attached_status.id
       expect(response).to have_http_status(200)
     end
   end