registration API
This commit is contained in:
parent
210362e665
commit
7e14eefc81
27 changed files with 216 additions and 136 deletions
|
@ -57,6 +57,22 @@ RSpec.describe Api::StatusesController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
before do
|
||||
post :destroy, params: { id: status.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'removes the status' do
|
||||
expect(Status.find_by(id: status.id)).to be nil
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #reblog' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
|
@ -85,6 +101,27 @@ RSpec.describe Api::StatusesController, type: :controller do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'POST #unreblog' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
before do
|
||||
post :reblog, params: { id: status.id }
|
||||
post :unreblog, params: { id: status.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'updates the reblogs count' do
|
||||
expect(status.reblogs_count).to eq 0
|
||||
end
|
||||
|
||||
it 'updates the reblogged attribute' do
|
||||
expect(user.account.reblogged?(status)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #favourite' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
|
@ -112,4 +149,25 @@ RSpec.describe Api::StatusesController, type: :controller do
|
|||
expect(hash_body[:favourited]).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #unfavourite' do
|
||||
let(:status) { Fabricate(:status, account: user.account) }
|
||||
|
||||
before do
|
||||
post :favourite, params: { id: status.id }
|
||||
post :unfavourite, params: { id: status.id }
|
||||
end
|
||||
|
||||
it 'returns http success' do
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'updates the favourites count' do
|
||||
expect(status.favourites_count).to eq 0
|
||||
end
|
||||
|
||||
it 'updates the favourited attribute' do
|
||||
expect(user.account.favourited?(status)).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue