peers_spec.rb 685 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Peers' do
  4. describe 'GET /api/v1/instance/peers' do
  5. context 'with peers api enabled' do
  6. before { Setting.peers_api_enabled = true }
  7. it 'returns http success' do
  8. get api_v1_instance_peers_path
  9. expect(response)
  10. .to have_http_status(200)
  11. expect(body_as_json)
  12. .to be_an(Array)
  13. end
  14. end
  15. context 'with peers api diabled' do
  16. before { Setting.peers_api_enabled = false }
  17. it 'returns http not found' do
  18. get api_v1_instance_peers_path
  19. expect(response)
  20. .to have_http_status(404)
  21. end
  22. end
  23. end
  24. end