-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Here you will find what little you need to know about the Rails Service Generator gem.
A very simple gem for Rails that adds a generator for easily creating a service class and its accompanying spec file.
At this time, the gem only creates an RSpec test file. MiniTest and Test::Unit support forthcoming.
Rails 3.2.19 and higher
Add this line to your application's Gemfile:
gem 'rails_services'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rails_services
$ rails generate rails_services:create Service Model|Controller Sub-folder^
$ rails generate rails_services:destroy Service Model|Controller Sub-folder^
^Sub-folders are optional but, at this time, you may only use one sub-folder. I generally use the sub-folders when I have a naturally grouped set of services.
Two files are created:
- app/services/model|controller/[sub-folder]/thing.rb
- spec/services/model|controller/[sub-folder]/thing_spec.rb