Update to the Rails Services Gem
A couple of years back I released my first gem, Rails Services. It’s a very simple gem and project, adding two generators to your Rails application: rails_services:create and rails_services:destroy.
The long and short of it is that you run a rails generator, providing a few arguments and wait while the generator creates a Service class and a corresponding test file.
What’s New
Basically, I finally got around to making the generation of the test file (spec or unit) dynamic … and maybe did a little code clean-up along the way.
Install
Usage
Generate your service.
Terminal
Output
That command will generate a base service class with the following data.
It has served me well and saved me time as I tend to use services a lot in my Rails apps over loading up a models or controller (or delving too deeply into the concerns).
Integration Tests with Minitest
Over the course of 2014 I focused a great deal of my energy at work coming up with a decent test suite for our application. Our application was developed over the course of late 2012 and most of 2013 but, unfortunately, was done so with only about 5% test coverage.
RailsServices Gem Reaches 2.0.0
Since early-2014, I began to move away from the strict MVC approach with our Rails application. As I refactored some of our fatter models and not-so-skinny controllers, I wrote quite a few service classes. As a typical, developer, this was just too “hard” :). Naturally, I needed a generator to create these classes - and their attendant test scripts. So, I created my first gem, Rails Services.