]> cat aescling's git repositories - mastodon.git/blob - spec/controllers/well_known/nodeinfo_controller_spec.rb
Add a nodeinfo endpoint (#12002)
[mastodon.git] / spec / controllers / well_known / nodeinfo_controller_spec.rb
1 require 'rails_helper'
2
3 describe WellKnown::NodeInfoController, type: :controller do
4 render_views
5
6 describe 'GET #index' do
7 it 'returns json document pointing to node info' do
8 get :index
9
10 expect(response).to have_http_status(200)
11 expect(response.content_type).to eq 'application/json'
12
13 json = body_as_json
14
15 expect(json[:links]).to be_an Array
16 expect(json[:links][0][:rel]).to eq 'http://nodeinfo.diaspora.software/ns/schema/2.0'
17 expect(json[:links][0][:href]).to include 'nodeinfo/2.0'
18 end
19 end
20
21 describe 'GET #show' do
22 it 'returns json document with node info properties' do
23 get :show
24
25 expect(response).to have_http_status(200)
26 expect(response.content_type).to eq 'application/json'
27
28 json = body_as_json
29
30 expect(json[:version]).to eq '2.0'
31 expect(json[:usage]).to be_a Hash
32 expect(json[:software]).to be_a Hash
33 expect(json[:protocols]).to be_an Array
34 end
35 end
36 end
This page took 0.097373 seconds and 6 git commands to generate.