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:
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.
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.
Generate your service.
That command will generate a base service class with the following data.
It will also create a related test file for you.
Or, if you’re using Rspec
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).