d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksarequire 'spec_helper'
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksadescribe Api::V1::ProofStatusesController do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa let(:proof_status) { create :proof_status_open }
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa context 'on GET to index' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa context 'requesting json representation', api_specification: true do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa before do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa get :index, format: :json
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa it { should respond_with :success }
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa it 'respond with json content type' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa expect(response.content_type.to_s).to eq('application/json')
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa context 'on GET to show' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa context 'requesting json representation', api_specification: true do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa let(:proof_status_schema) { schema_for('proof_status') }
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa before do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa get :show,
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa id: proof_status.to_param,
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa format: :json
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa it { should respond_with :success }
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa it 'respond with json content type' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa expect(response.content_type.to_s).to eq('application/json')
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa it 'should return a representation that validates against the schema' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa VCR.use_cassette 'api/json-schemata/proof_status' do
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa expect(response.body).
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa to match_json_schema(proof_status_schema)
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksa end
d07459b377994e33eba1ad77765046c986dcb986Eugen Kuksaend