Testing Thor Ruby Required Options

Testing Thor Ruby Required Options

Thor Ruby gem is a great tool to quickly build a CLI (Command-line interface) app. Although there are lots of tutorials for building a CLI with Thor from scratch, there aren’t a lot of them on how to test Thor, especially covering scenarios such as required options. Thor makes it easy to specify options and arguments for Thor commands. However, I didn’t find it easy to test them in the documentation....

3 min Â· Stefanni Brasil
How to RSpec a Rails JSON API responses with Jbuilder

How to RSpec a Jbuilder response from a Rails JSON API

For rspec-rails users, when testing a controller action that uses Jbuilder as a serializer, and you want to test that the response includes exactly what you expect from the Jbuilder serializer, you need to enable render_views in your specs. That’s because in RSpec, rendering the content of view templates is disabled by default. But when using Jbuilder, you do want to render views because that’s how Jbuilder serializes the response. And that’s what render_views does: it enables view rendering for controllers specs....

2 min Â· Stefanni Brasil