Skip to content

Instantly share code, notes, and snippets.

@steff-mueller
Last active December 14, 2015 17:48
Show Gist options
  • Save steff-mueller/5124242 to your computer and use it in GitHub Desktop.
Save steff-mueller/5124242 to your computer and use it in GitHub Desktop.
DSL for REST service testing
describe 'User Administration', () ->
it 'Get user', req ->
req.get '/users'
.expectStatus 200
.expectJSONTypes
id: Number,
username: String,
is_admin: Boolean
.expectJSON
id: 3,
username: 'johndoe',
is_admin: false
it 'Delete user should return 200', req, data ->
req.delete '/users' + data.id #Use JSON response from previous test
.expectStatus 200
@mythz
Copy link

mythz commented Mar 9, 2013

[User Administration]

    [GET /users]  #Get All Users
    status = 200
    JSONTypes = [ ['id', 'number'], ['username', 'string', 'is_admin', 'bool'] ]
    JSONValues = [ ['id', 3], ['username', 'johndoe', 'is_admin', false] ]

    [DELETE /users/3] #Delete user
    status = 200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment