ontology_versions_controller_spec.rb revision e568cc4d63d7d940acafc114bc74287b9cc0e480
943N/Arequire 'spec_helper'
98N/A
98N/Adescribe Api::V1::OntologyVersionsController do
919N/A let(:version) { create :ontology_version_with_file }
919N/A let(:ontology) { version.ontology }
919N/A let(:repository) { ontology.repository }
919N/A
919N/A context 'on GET to index' do
98N/A context 'requesting json representation', api_specification: true do
919N/A let(:ontology_versions_schema) do
919N/A schema_for_command('ontology/ontology_versions', :get, 200)
919N/A end
98N/A
919N/A before do
919N/A get :index,
919N/A repository_id: repository.to_param,
919N/A ontology_id: ontology.to_param,
919N/A locid: ontology.locid,
919N/A format: :json
919N/A end
98N/A
98N/A it { should respond_with :success }
98N/A
98N/A it 'respond with json content type' do
1124N/A expect(response.content_type.to_s).to eq('application/json')
1276N/A end
1124N/A
1124N/A it 'should return a representation that validates against the schema' do
851N/A VCR.use_cassette 'api/json-schemata/ontology/ontology_versions' do
98N/A expect(response.body).
98N/A to match_json_schema(ontology_versions_schema)
98N/A end
98N/A end
98N/A end
98N/A end
98N/A
98N/A context 'on GET to show' do
98N/A context 'requesting json representation', api_specification: true do
98N/A let(:ontology_version_schema) { schema_for('ontology_version') }
1276N/A
1276N/A before do
1276N/A get :show,
1276N/A repository_id: repository.to_param,
1276N/A ontology_id: ontology.to_param,
1276N/A reference: version.number,
98N/A id: version.to_param,
1276N/A locid: version.locid,
1276N/A format: :json
98N/A end
1276N/A
1276N/A it { should respond_with :success }
1276N/A
1276N/A it 'respond with json content type' do
1276N/A expect(response.content_type.to_s).to eq('application/json')
1276N/A end
1276N/A
1276N/A it 'should return a representation that validates against the schema' do
1276N/A VCR.use_cassette 'api/json-schemata/ontology_version' do
1276N/A expect(response.body).
98N/A to match_json_schema(ontology_version_schema)
1276N/A end
98N/A end
1276N/A end
1276N/A end
98N/Aend
98N/A