require "spec_helper" RSpec.describe Endpoints::<%= plural_class_name %> do include Committee::Test::Methods include Rack::Test::Methods def app Routes end def schema_path "./schema/schema.json" end describe 'GET <%= url_path %>' do it 'returns correct status code and conforms to schema' do get '<%= url_path %>' assert_equal 200, last_response.status assert_schema_conform end end describe 'POST <%= url_path %>' do it 'returns correct status code and conforms to schema' do header "Content-Type", "application/json" post '<%= url_path %>', MultiJson.encode({}) assert_equal 201, last_response.status assert_schema_conform end end describe 'GET <%= url_path %>/:id' do it 'returns correct status code and conforms to schema' do get "<%= url_path %>/123" assert_equal 200, last_response.status assert_schema_conform end end describe 'PATCH <%= url_path %>/:id' do it 'returns correct status code and conforms to schema' do header "Content-Type", "application/json" patch '<%= url_path %>/123', MultiJson.encode({}) assert_equal 200, last_response.status assert_schema_conform end end describe 'DELETE <%= url_path %>/:id' do it 'returns correct status code and conforms to schema' do delete '<%= url_path %>/123' assert_equal 200, last_response.status assert_schema_conform end end end