6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksarequire 'spec_helper'
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksadescribe Api::V1::ProofAttemptConfigurationsController do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa let(:proof_attempt) { create :proof_attempt }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa let(:pa_configuration) { proof_attempt.proof_attempt_configuration }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa let(:theorem) { proof_attempt.theorem }
6038b00107b7bc45a596b94529bfb544a3ed6a65Eugen Kuksa let(:repository) { theorem.ontology.repository }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'on GET to selected_axioms' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'requesting json representation', api_specification: true do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa before do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa get :selected_axioms,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa repository_id: repository.to_param,
6038b00107b7bc45a596b94529bfb544a3ed6a65Eugen Kuksa proof_attempt_id: proof_attempt.to_param,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa id: pa_configuration.to_param,
d327eb79653cf7820fe583473ab35816d44cd757Eugen Kuksa locid: url_for([proof_attempt,
d327eb79653cf7820fe583473ab35816d44cd757Eugen Kuksa :'proof-attempt-configuration', :selected_axioms]),
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa format: :json
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it { should respond_with :success }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it 'respond with json content type' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa expect(response.content_type.to_s).to eq('application/json')
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'on GET to selected_theorems' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'requesting json representation', api_specification: true do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa before do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa get :selected_theorems,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa repository_id: repository.to_param,
6038b00107b7bc45a596b94529bfb544a3ed6a65Eugen Kuksa proof_attempt_id: proof_attempt.to_param,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa id: pa_configuration.to_param,
d327eb79653cf7820fe583473ab35816d44cd757Eugen Kuksa locid: url_for([proof_attempt,
d327eb79653cf7820fe583473ab35816d44cd757Eugen Kuksa :'proof-attempt-configuration', :selected_theorems]),
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa format: :json
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it { should respond_with :success }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it 'respond with json content type' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa expect(response.content_type.to_s).to eq('application/json')
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'on GET to show' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa context 'requesting json representation', api_specification: true do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa let(:proof_attempt_configuration_schema) do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa schema_for('proof_attempt_configuration')
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa before do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa get :show,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa repository_id: repository.to_param,
6038b00107b7bc45a596b94529bfb544a3ed6a65Eugen Kuksa proof_attempt_id: proof_attempt.to_param,
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa id: pa_configuration.to_param,
d327eb79653cf7820fe583473ab35816d44cd757Eugen Kuksa locid: url_for([proof_attempt, :'proof-attempt-configuration']),
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa format: :json
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it { should respond_with :success }
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it 'respond with json content type' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa expect(response.content_type.to_s).to eq('application/json')
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa it 'should return a representation that validates against the schema' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa VCR.use_cassette 'api/json-schemata/ontology/proof_attempt_configuration' do
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa expect(response.body).
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa to match_json_schema(proof_attempt_configuration_schema)
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksa end
6436a931b73290f673566ca4d6e16705770cf348Eugen Kuksaend