nodeinfo_controller_spec.rb 975 B

123456789101112131415161718192021222324252627282930313233343536
  1. require 'rails_helper'
  2. describe WellKnown::NodeInfoController, type: :controller do
  3. render_views
  4. describe 'GET #index' do
  5. it 'returns json document pointing to node info' do
  6. get :index
  7. expect(response).to have_http_status(200)
  8. expect(response.media_type).to eq 'application/json'
  9. json = body_as_json
  10. expect(json[:links]).to be_an Array
  11. expect(json[:links][0][:rel]).to eq 'http://nodeinfo.diaspora.software/ns/schema/2.0'
  12. expect(json[:links][0][:href]).to include 'nodeinfo/2.0'
  13. end
  14. end
  15. describe 'GET #show' do
  16. it 'returns json document with node info properties' do
  17. get :show
  18. expect(response).to have_http_status(200)
  19. expect(response.media_type).to eq 'application/json'
  20. json = body_as_json
  21. expect(json[:version]).to eq '2.0'
  22. expect(json[:usage]).to be_a Hash
  23. expect(json[:software]).to be_a Hash
  24. expect(json[:protocols]).to be_an Array
  25. end
  26. end
  27. end