Testing CLI apps with Aruba (Ruby or Not)

CLI Acceptance Testing One of my hobbies is writing little CLI apps to create workflows, automate and solve issues I’m having. The one I’ve probably tinkered with the most is gitsweeper. Gitsweeper is a golang re-write of git-sweep, a python CLI tool I’d been using for a while to clean up branches that had been merged into the master branch. Because these apps are very small and self-contained, I want to be able to extensively test the happy and sad paths. For something like gitsweeper, there are a number of scenarios and edge cases to test against: A non-existent git repo, no branches being available, lack of permissions and so on. ...

April 9, 2024 · 9 min · Peter Souter

Drying up rspec with shared_examples

Day 17 in the #vDM30in30 Header image taken from https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples One of the areas where it’s easy to have WET (We Enjoy Typing) code that you want to DRY (Don’t Repeat Yourself) up, is tests. When writing tests for similar areas of code, it’s easy to end up copy and pasting. You have to pieces of functionality that need to be tested in the same way, so why not copy and paste the testing code? ...

November 17, 2016 · 11 min · Peter Souter

Capybara Smoketests: Not just for Ruby!

99% of the time, if I need to code something, my language of choice is Ruby. Nothing in particular drove me to start using it, but I was at a Java house which switched to being a Ruby house, so I changed accordingly. Since then I’ve been doing a lot of devops-y stuff, and a lot of devops tools are written in Ruby, so it’s kinda stuck. Plus, I’ve grown fond of how easy it is to throw together a proof of concept together without much setup, and there are hundreds of gems out there that you can build on. ...

November 28, 2013 · 4 min · Peter Souter