update map/topic delete action test

This commit is contained in:
Devin Howard 2016-03-14 11:46:45 +08:00
parent 7716462c8f
commit 32326ff4af
2 changed files with 5 additions and 6 deletions

View file

@ -89,7 +89,8 @@ RSpec.describe MapsController, type: :controller do
expect do
delete :destroy, { id: unowned_map.to_param, format: :json }
end.to change(Map, :count).by(0)
expect(response.body).to eq("unauthorized")
expect(response.body).to eq ''
expect(response.status).to eq 403
end
it 'deletes owned map' do
@ -97,7 +98,8 @@ RSpec.describe MapsController, type: :controller do
expect do
delete :destroy, { id: owned_map.to_param, format: :json }
end.to change(Map, :count).by(-1)
expect(response.body).to eq("success")
expect(response.body).to eq ''
expect(response.status).to eq 204
end
end
end

View file

@ -92,10 +92,7 @@ RSpec.describe TopicsController, type: :controller do
expect do
delete :destroy, { id: owned_topic.to_param, format: :json }
end.to change(Topic, :count).by(-1)
end
it 'return 204 NO CONTENT' do
delete :destroy, { id: owned_topic.to_param, format: :json }
expect(response.body).to eq ''
expect(response.status).to eq 204
end
end