Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yhirano55/poro-rails
Simple Rails Generators for Plain Old Ruby Objects, Form Objects, and Service Objects
https://github.com/yhirano55/poro-rails
form-objects generator plain-old-ruby-objects ruby-on-rails service-objects
Last synced: 16 days ago
JSON representation
Simple Rails Generators for Plain Old Ruby Objects, Form Objects, and Service Objects
- Host: GitHub
- URL: https://github.com/yhirano55/poro-rails
- Owner: yhirano55
- License: mit
- Created: 2019-05-19T13:09:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-19T13:38:03.000Z (over 5 years ago)
- Last Synced: 2024-11-30T19:45:51.790Z (22 days ago)
- Topics: form-objects, generator, plain-old-ruby-objects, ruby-on-rails, service-objects
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# poro-rails
This gem provides generators of **Plain Old Ruby Objects**, **Form Objects** and **Service Objects** for Ruby on Rails.
## Installation
```ruby
gem 'poro-rails', group: :development
```And then execute:
$ bundle
Or install it yourself as:
$ gem install poro-rails
## Usage
### Plain Old Ruby Objects
Generate a plain old ruby object via command line:
$ rails g poro Person
create app/models/person.rb
invoke test_unit
create test/models/person_test.rbThese files are created (if it use RSpec in your project, it creates a spec file):
```ruby
# app/models/person.rb
class Person
# include ActiveModel::Model
end
``````ruby
# test/models/person_test.rb
require 'test_helper'class PersonTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
```### Form Objects
Generate a form object via command line:
$ rails g form create_user
create app/forms/create_user_form.rb
invoke test_unit
create test/forms/create_user_form_test.rbThese files are created (if it use RSpec in your project, it creates a spec file):
```ruby
# app/forms/create_user_form.rb
class CreateUserForm
# include ActiveModel::Model
end
``````ruby
# test/forms/create_user_form_test.rb
require 'test_helper'class CreateUserFormTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
```### Service Objects
Generate a service object via command line:
$ bin/rails g service create_payment
create app/services/create_payment_service.rb
invoke test_unit
create test/services/create_payment_service_test.rbThese files are created (if it use RSpec in your project, it creates a spec file):
```ruby
# app/services/create_payment_service.rb
class CreatePaymentService
# include ActiveModel::Model
end
``````ruby
# test/services/create_payment_service_test.rb
require 'test_helper'class CreatePaymentServiceTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
```## License
MIT