93266970477c9fdff01b03720e0929e514d6f489Tim Reddehaserequire 'spec_helper'
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehasedescribe Api::V1::OntologiesController do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase context 'Ontology Instance' do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase let(:ontology) { create :single_ontology, state: 'done' }
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase let(:repository) { ontology.repository }
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase context 'on GET to show' do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase context 'with format json', api_specification: true do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase let(:ontology_schema) { schema_for('ontology') }
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase before do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase get :show,
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase repository_id: repository.to_param,
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase format: :json,
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase locid: ontology.locid,
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase id: ontology.to_param
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase it { should respond_with :success }
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase it 'respond with json content type' do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase expect(response.content_type.to_s).to eq('application/json')
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase it 'should return a representation that validates against the schema' do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase VCR.use_cassette 'api/json-schemata/ontology' do
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase expect(response.body).to match_json_schema(ontology_schema)
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehase end
93266970477c9fdff01b03720e0929e514d6f489Tim Reddehaseend