All Projects → iridakos → Duckrails

iridakos / Duckrails

Licence: mit
Development tool to mock API endpoints quickly and easily (docker image available)

Programming Languages

ruby
36898 projects - #4 most used programming language
SCSS
7915 projects
HTML
75241 projects
Gherkin
971 projects
javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to Duckrails

Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (-85.03%)
Mutual labels:  api, mock, mocking
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-91.01%)
Mutual labels:  api, apis, api-server
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-97.1%)
Mutual labels:  api, mock, mocking
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+104.02%)
Mutual labels:  api, mock, mocking
CNeptune
CNeptune improve productivity & efficiency by urbanize .net module with meta-code to lay foundation for frameworks
Stars: ✭ 30 (-98.22%)
Mutual labels:  mock, productivity, mocking
Nei Toolkit
NEI 接口文档管理平台配套自动化工具
Stars: ✭ 781 (-53.79%)
Mutual labels:  api, api-server, mock
Gock
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽
Stars: ✭ 1,185 (-29.88%)
Mutual labels:  api, mock, mocking
Graphql devise
GraphQL interface on top devise_token_auth
Stars: ✭ 100 (-94.08%)
Mutual labels:  api, api-server
Go Sdk
A composable toolbox of libraries to build everything from CLIs to enterprise applications.
Stars: ✭ 103 (-93.91%)
Mutual labels:  api, api-server
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (-93.73%)
Mutual labels:  mock, mocking
Parrot
✨ Scenario-based HTTP mocking
Stars: ✭ 109 (-93.55%)
Mutual labels:  mock, mocking
Unit Threaded
Advanced unit test framework for D
Stars: ✭ 100 (-94.08%)
Mutual labels:  mock, mocking
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (-20.47%)
Mutual labels:  mock, mocking
Automation Arsenal
Curated list of popular Java and Kotlin frameworks, libraries and tools related to software testing, quality assurance and adjacent processes automation.
Stars: ✭ 105 (-93.79%)
Mutual labels:  productivity, mocking
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-94.32%)
Mutual labels:  api, api-server
Really Need
Node require wrapper with options for cache busting, pre- and post-processing
Stars: ✭ 108 (-93.61%)
Mutual labels:  mock, mocking
Tutorialdb
A search 🔎 engine for programming/dev tutorials, See it in action 👉
Stars: ✭ 93 (-94.5%)
Mutual labels:  api, developer-tools
Mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Stars: ✭ 10,048 (+494.56%)
Mutual labels:  mock, mocking
Mockit
A tool to quickly mock out end points, setup delays and more...
Stars: ✭ 1,534 (-9.23%)
Mutual labels:  api, mock
Anyapi
AnyAPI is a library that helps you to write any API wrappers with ease and in pythonic way.
Stars: ✭ 126 (-92.54%)
Mutual labels:  api, apis

DuckRails GitHub version Build Status

DuckRails is a development tool.

Its main purpose is to allow developers to quickly mock API endpoints that for many possible reasons they can't reach at a specific time.

If it looks like a duck, walks like a duck and quacks like a duck, then it's a duck 🦆

Home Page

How it works

The application allows creating new routes dynamically to which developers can assign static or dynamic responses:

  • body
  • headers
  • content type
  • status code

or even cause delays, timeouts etc.

Guides

The repository's wiki pages contain all you need to know.

You can find the old DuckRails' guides at my blog.

Example

Mocks index page

Mocks index page

Changing mocks order

Change mocks order

Setting general mock properties

General mock properties

Defining the response body

Defining the response body

Setting response headers

Setting response headers

Setting some advanced configuration (delays, dynamic headers, content type & status)

Advanced configuration

Upon save the route becomes available to the application and you can use the endpoint:

Request Headers

Supported response functionality

You can define static or dynamic responses for a mock.

Currently supported dynamic types are:

  • Embedded Ruby
  • JavaScript

Embedded Ruby

When specifying dynamic content of embedded Ruby (more options to be added), you can read as local variables:

  • @parameters: The parameters of the request
  • @request: The request
  • @response: The response

JavaScript

When specifying dynamic content of JavaScript type, you can read as local variables:

  • parameters: The parameters of the request
  • headers: The request headers

The script should always return a string (for JSON use JSON.stringify(your_variable))

Route paths

You can specify routes and access their parts in the @parameters variable, for example:

/authors/:author_id/posts/:post_id

give you access to the parameters with:

@parameters[:author_id]

@parameters[:post_id]

Quick setup (development environment)

  • Clone the repository.
  • Copy the sample database configuration file (config/database.yml.sample) under config/database.yml and edit it to reflect your preferred db configuration (defaults to sqlite3). If you change the database adapter, make sure you include the appropriate gem in your Gemfile (ex. for mysql gem 'mysql2')
  • Execute bundle install to install the required gems.
  • Execute rake db:setup to setup the database.
  • Execute rails server to start the application on the default port.
  • Duckrails can be run concurrently and in parallelism, thus instead of the default rails server, you may start the puma server with something like: bundle exec puma -t 8:16 -w 3

Better setup (production environment)

  • Clone the repository.
  • Copy the sample database configuration file (config/database.yml.sample) under config/database.yml and edit it to reflect your preferred db configuration (defaults to sqlite3). If you change the database adapter, make sure you include the appropriate gem in your Gemfile (ex. for mysql gem 'mysql2')
  • Execute bundle install to install the required gems.
  • Export an env variable for your secret key base: export SECRET_KEY_BASE="your_secret_key_base_here"
  • Execute RAILS_ENV=production rake db:setup to setup the database.
  • Execute RAILS_ENV=production rake assets:precompile to generate the assets.
  • Execute bundle exec rails s -e production to start the application on the default port.
  • Duckrails can be run concurrently and in parallelism, thus instead of the default rails server, you may start the puma server with something like: RAILS_ENV=production bundle exec puma -t 8:16 -w 3

Database configuration

The application is by default configured to use sqlite3. If you want to use another configuration, update the config/database.yml accordingly to match your setup.

Docker

A docker image is available at docker hub under iridakos/duckrails.

To obtain the image use:

docker pull iridakos/duckrails

To start the application and bind it to a port (ex. 4000) use:

docker run -p 4000:80 iridakos/duckrails:latest

Contributing

  1. Fork it ( https://github.com/iridakos/duckrails/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

This application is open source under the MIT License terms.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].