endo

This is a tool for testing json api endpoints.

Usage

Write endo file. ex. endo/sample.rb

base_url 'http://localhost:3000'
basic_auth 'user', 'pass'

get '/articles' do
  expect(header: 'Content-Type').to equal 'application/json; charset=utf-8'
end

post '/articles.json' do
  param 'article[title]', 'hello'
  param 'article[content]', 'Hello, world!'
end

get '/articles/:article_id' do
  param :article_id do
    from :post, '/articles.json', 'id'
  end

  expect(header: 'Content-Type').to equal 'application/json'
  expect(body: 'title' }).to equal 'hello'
end

Exec endo command.

ss_ 2016-05-02 16 12 58

Installation

Add this line to your application's Gemfile:

gem 'endo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install endo