0
0
Fork 0

Allow multiple pinned statuses to be shown and make them be ordered b… (#4690)

* Allow multiple pinned statuses to be shown and make them be ordered by pinned date

* Set timestamps NOT NULL

* Make single-line pinned_statuses

* Spec for pinned_statuses

* Remove redundant empty line
This commit is contained in:
nullkal 2017-08-26 01:50:52 +09:00 committed by Eugen Rochko
parent fb8aa2b3ba
commit c2af138113
6 changed files with 27 additions and 3 deletions

View file

@ -10,6 +10,13 @@ RSpec.describe AccountsController, type: :controller do
let!(:status2) { Status.create!(account: alice, text: 'Boop', thread: status1) }
let!(:status3) { Status.create!(account: alice, text: 'Picture!') }
let!(:status4) { Status.create!(account: alice, text: 'Mentioning @alice') }
let!(:status5) { Status.create!(account: alice, text: 'Kitsune') }
let!(:status6) { Status.create!(account: alice, text: 'Neko') }
let!(:status7) { Status.create!(account: alice, text: 'Tanuki') }
let!(:status_pin1) { StatusPin.create!(account: alice, status: status5, created_at: 5.days.ago) }
let!(:status_pin2) { StatusPin.create!(account: alice, status: status6, created_at: 2.years.ago) }
let!(:status_pin3) { StatusPin.create!(account: alice, status: status7, created_at: 10.minutes.ago) }
before do
status3.media_attachments.create!(account: alice, file: fixture_file_upload('files/attachment.jpg', 'image/jpeg'))
@ -70,6 +77,14 @@ RSpec.describe AccountsController, type: :controller do
expect(statuses[1]).to eq status2
end
it 'assigns @pinned_statuses' do
pinned_statuses = assigns(:pinned_statuses).to_a
expect(pinned_statuses.size).to eq 3
expect(pinned_statuses[0]).to eq status7
expect(pinned_statuses[1]).to eq status5
expect(pinned_statuses[2]).to eq status6
end
it 'returns http success' do
expect(response).to have_http_status(:success)
end