assert response body based on spec examples

This commit is contained in:
domaindrivendev
2016-02-23 00:30:10 -08:00
parent 071239727a
commit 9ad7a49e6d
16 changed files with 218 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"

View File

@@ -0,0 +1,25 @@
#SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

View File

@@ -1,5 +1,5 @@
Rails.application.routes.draw do
mount SwaggerRails::Engine => '/api-docs'
resources :blogs, defaults: { :format => :json }
resources :blogs, only: [ :create, :index, :show ]
mount SwaggerRails::Engine => '/api-docs'
end

View File

@@ -24,8 +24,8 @@
}
],
"responses": {
"200": {
"description": "Ok",
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/Blog"
}
@@ -58,7 +58,10 @@
"200": {
"description": "Ok",
"schema": {
"$ref": "#/definitions/Blog"
"type": "array",
"item": {
"$ref": "#/definitions/Blog"
}
}
}
}