How To Test Ruby CLI: The Setup

One of the most interesting challenges I met during Hanami development is to write isolated integration tests. The framework ships with an extensive Command Line Interface (CLI) to generate (or destroy) code, start the server, open a Ruby (or a database) console, create/drop the database, run the migrations, precompile assets, and print informations. Full Isolation As I want to have integration tests to use CLI commands for real, the test suite is free of mocks/stubs. »

Isolate Global State

Using global state in software programs, is handy for development, but evil to maintain. It can easily become source of bugs that are triggered by edge cases which are hard to track down. Let’s see why, and how we can mitigate the problem. An Example Of The Problem For instance, in Hanami code base we need to test how the framework configures itself according to certain env variables. We used to test like this: »

The Penguin That Can't Fly

A short story about OOP, interfaces and soft typing Today is the day at the headquarters of Spectacular Foo Ltd. The rising firm of the indie gaming scene is going to release its next blockbuster title: Banal Birds. The year is 2019, Ruby 3 is three times faster and has soft typing, what a crazy coincidence that solves everything! It was a nostalgic decision but, you, as the lead developer decided to use Ruby for this project. »

25,000+ Req/s for Rack JSON API with MRuby

Last month I gave the closing keynote at RubyDay 2015 by talking about Lotus and the future of Ruby. For the attendees, the most surprising part of my speech was about MRuby. It’s a minimal version of Ruby, that can be embedded in any system that supports C. I think that this technology can play a key role for Ruby in the next years. The simplicity of the language can be used within complex systems. »

JSON API Apps With Lotus

Do you need a fast and lightweight JSON API app? It must be powerful, flexible, quick to develop and easy to deploy? There is a simple solution for all these requirements: to use Lotus gems to build it. Lotus is well known for full stack web applications (via lotusrb), but all the gems of this toolkit can be used as standalone components in existing Ruby applications. It this case we will compose together the router and the actions to create a JSON API app that returns informations for books. »