rails_ops 1.1.26 → 1.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +39 -8
- data/VERSION +1 -1
- data/lib/generators/operation/operation_generator.rb +21 -3
- data/lib/generators/operation/templates/controller.erb +24 -7
- data/lib/generators/operation/templates/create.erb +4 -0
- data/lib/generators/operation/templates/destroy.erb +4 -0
- data/lib/generators/operation/templates/load.erb +8 -0
- data/lib/generators/operation/templates/update.erb +4 -0
- data/rails_ops.gemspec +3 -3
- data/test/unit/rails_ops/generators/operation_generator_test.rb +84 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bcce101893137c4a67443fb2f0c056695a9f31d9eddd4d8db480e2e27abb004
|
4
|
+
data.tar.gz: 360264275974a50bf59bde14c29ea5a10192d35bc7c983829a190b56aa4bc853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3334b17bf543eb8168f13388a822e3572c9a6bb4522cc8db8d27755ffda18cccaba4a7283efc21e8d4da3bd5c5e2ab64d7eef2c5ad7478aef57b432dd23f06d
|
7
|
+
data.tar.gz: 87e7d4cc99de70f5287f1c639b9607dfac59a8fcf492225fbc3956f49f2f7f372724eb153dd9016cc2927d9e5116a0522531e681fcd577314118ecda484f7393
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -67,15 +67,16 @@ Requirements & Installation
|
|
67
67
|
following inside of the `Application` class within your
|
68
68
|
`config/application.rb`:
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
```ruby
|
71
|
+
app_operations = "#{Rails.root}/app/operations"
|
72
|
+
ActiveSupport::Dependencies.autoload_paths.delete(app_operations)
|
73
|
+
|
74
|
+
module Operations; end
|
75
|
+
loader = Rails.autoloaders.main
|
76
|
+
loader.push_dir(app_operations, namespace: Operations)
|
77
|
+
```
|
74
78
|
|
75
|
-
|
76
|
-
# that will run when loaded.
|
77
|
-
config.paths.add 'lib', eager_load: true
|
78
|
-
```
|
79
|
+
Taken from [this github issues comment](https://github.com/rails/rails/issues/40126#issuecomment-816275285).
|
79
80
|
|
80
81
|
Operation Basics
|
81
82
|
----------------
|
@@ -1546,6 +1547,36 @@ flags:
|
|
1546
1547
|
|
1547
1548
|
Or if you want to skip them all: `--only-operations`.
|
1548
1549
|
|
1550
|
+
You can also add a module as a namespace, all generated files will be put in
|
1551
|
+
the proper subfolders and modules by using the `--module` option.
|
1552
|
+
|
1553
|
+
As an example:
|
1554
|
+
|
1555
|
+
```ruby
|
1556
|
+
rails g operation User --module Admin
|
1557
|
+
```
|
1558
|
+
|
1559
|
+
This will generate the following operations:
|
1560
|
+
|
1561
|
+
* `app/operations/admin/user/load.rb`
|
1562
|
+
* `app/operations/admin/user/create.rb`
|
1563
|
+
* `app/operations/admin/user/update.rb`
|
1564
|
+
* `app/operations/admin/user/destroy.rb`
|
1565
|
+
|
1566
|
+
These operations will be namespaced in the `Admin` module, e.g. `app/operations/admin/user/load.rb` will define `Operations::Admin::User::Load`.
|
1567
|
+
|
1568
|
+
It will also generate the controller `app/controllers/admin/users_controller.rb` and the following
|
1569
|
+
empty view files:
|
1570
|
+
|
1571
|
+
* `app/views/admin/users/index.html.haml`
|
1572
|
+
* `app/views/admin/users/show.html.haml`
|
1573
|
+
* `app/views/admin/users/new.html.haml`
|
1574
|
+
* `app/views/admin/users/edit.html.haml`
|
1575
|
+
|
1576
|
+
Both lower- and uppercase will generate the same files (i.e. `--module Admin` and `--module admin` are equal).
|
1577
|
+
|
1578
|
+
You can even nest the generated files deeper, `--module Admin::Foo` and `--module admin/foo` will both work.
|
1579
|
+
|
1549
1580
|
Of course, at this point, the operations will need some adaptions, especially the
|
1550
1581
|
[parameter schemas](#validating-params), and the controllers need the logic for the
|
1551
1582
|
success and failure cases, as this depends on your application.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.27
|
@@ -5,13 +5,23 @@ class OperationGenerator < Rails::Generators::NamedBase
|
|
5
5
|
class_option :skip_views, type: :boolean, desc: "Don't add the views."
|
6
6
|
class_option :skip_routes, type: :boolean, desc: "Don't add routes to config/routes.rb."
|
7
7
|
class_option :only_operations, type: :boolean, desc: 'Only add the operations. This is equal to specifying --skip-controller --skip-routes --skip-views'
|
8
|
+
class_option :module, type: :string, desc: 'Add the operations in a module, e.g. "Admin" results in namespacing everything in the Admin module'
|
8
9
|
|
9
10
|
def add_operations
|
10
11
|
@class_name = name.classify
|
11
12
|
@underscored_name = name.underscore
|
12
13
|
@underscored_pluralized_name = name.underscore.pluralize
|
13
14
|
|
14
|
-
operations_path =
|
15
|
+
operations_path = 'app/operations/'
|
16
|
+
|
17
|
+
if options[:module].present?
|
18
|
+
@module_name = options[:module].classify
|
19
|
+
@module_underscored_name = @module_name.underscore
|
20
|
+
|
21
|
+
operations_path += "#{@module_underscored_name}/"
|
22
|
+
end
|
23
|
+
|
24
|
+
operations_path += @underscored_name.to_s
|
15
25
|
|
16
26
|
template 'load.erb', "#{operations_path}/load.rb"
|
17
27
|
template 'create.erb', "#{operations_path}/create.rb"
|
@@ -22,7 +32,11 @@ class OperationGenerator < Rails::Generators::NamedBase
|
|
22
32
|
def add_controller
|
23
33
|
return if options[:skip_controller] || options[:only_operations]
|
24
34
|
|
25
|
-
controller_file_path =
|
35
|
+
controller_file_path = 'app/controllers/'
|
36
|
+
if @module_underscored_name.present?
|
37
|
+
controller_file_path += "#{@module_underscored_name}/"
|
38
|
+
end
|
39
|
+
controller_file_path += "#{@underscored_pluralized_name}_controller.rb"
|
26
40
|
@controller_name = "#{@class_name.pluralize}Controller"
|
27
41
|
|
28
42
|
template 'controller.erb', controller_file_path
|
@@ -31,7 +45,11 @@ class OperationGenerator < Rails::Generators::NamedBase
|
|
31
45
|
def add_views
|
32
46
|
return if options[:skip_views] || options[:only_operations]
|
33
47
|
|
34
|
-
views_folder =
|
48
|
+
views_folder = 'app/views/'
|
49
|
+
if @module_underscored_name.present?
|
50
|
+
views_folder += "#{@module_underscored_name}/"
|
51
|
+
end
|
52
|
+
views_folder += @underscored_pluralized_name.to_s
|
35
53
|
|
36
54
|
%w(index show new edit).each do |view|
|
37
55
|
template 'view.erb', "#{views_folder}/#{view}.html.haml"
|
@@ -1,16 +1,18 @@
|
|
1
|
-
|
1
|
+
<%
|
2
|
+
controller_code = <<-RUBY
|
3
|
+
class #{@controller_name} < ApplicationController
|
2
4
|
def index; end
|
3
5
|
|
4
6
|
def show
|
5
|
-
op Operations
|
7
|
+
op Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Load
|
6
8
|
end
|
7
9
|
|
8
10
|
def new
|
9
|
-
op Operations
|
11
|
+
op Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Create
|
10
12
|
end
|
11
13
|
|
12
14
|
def create
|
13
|
-
if run Operations
|
15
|
+
if run Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Create
|
14
16
|
# handle successful case
|
15
17
|
else
|
16
18
|
# handle error case
|
@@ -18,11 +20,11 @@ class <%= @controller_name %> < ApplicationController
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def edit
|
21
|
-
op Operations
|
23
|
+
op Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Update
|
22
24
|
end
|
23
25
|
|
24
26
|
def update
|
25
|
-
if run Operations
|
27
|
+
if run Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Update
|
26
28
|
# handle successful case
|
27
29
|
else
|
28
30
|
# handle error case
|
@@ -30,10 +32,25 @@ class <%= @controller_name %> < ApplicationController
|
|
30
32
|
end
|
31
33
|
|
32
34
|
def destroy
|
33
|
-
if run Operations
|
35
|
+
if run Operations#{ "::#{@module_name}" if @module_name.present? }::#{@class_name}::Destroy
|
34
36
|
# handle successful case
|
35
37
|
else
|
36
38
|
# handle error case
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
42
|
+
RUBY
|
43
|
+
-%>
|
44
|
+
<% if @module_name.present? -%>
|
45
|
+
module <%= @module_name %>
|
46
|
+
<% controller_code.split("\n").each do |line| -%>
|
47
|
+
<% if line.blank? -%>
|
48
|
+
|
49
|
+
<% else -%>
|
50
|
+
<%= line %>
|
51
|
+
<% end -%>
|
52
|
+
<% end -%>
|
53
|
+
end
|
54
|
+
<% else -%>
|
55
|
+
<%= controller_code -%>
|
56
|
+
<% end -%>
|
@@ -1,5 +1,13 @@
|
|
1
|
+
<% if @module_name.present? -%>
|
2
|
+
module Operations::<%= @module_name %>::<%= @class_name %>
|
3
|
+
<% else -%>
|
1
4
|
module Operations::<%= @class_name %>
|
5
|
+
<% end -%>
|
2
6
|
class Load < RailsOps::Operation::Model::Load
|
7
|
+
schema3 do
|
8
|
+
str! :id
|
9
|
+
end
|
10
|
+
|
3
11
|
model ::<%= @class_name %>
|
4
12
|
end
|
5
13
|
end
|
data/rails_ops.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rails_ops 1.1.
|
2
|
+
# stub: rails_ops 1.1.27 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "rails_ops".freeze
|
6
|
-
s.version = "1.1.
|
6
|
+
s.version = "1.1.27"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Sitrox".freeze]
|
11
|
-
s.date = "2022-
|
11
|
+
s.date = "2022-02-15"
|
12
12
|
s.files = [".github/workflows/rubocop.yml".freeze, ".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, "Appraisals".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "gemfiles/rails_5.1.gemfile".freeze, "gemfiles/rails_5.2.gemfile".freeze, "gemfiles/rails_6.0.gemfile".freeze, "gemfiles/rails_6.1.gemfile".freeze, "gemfiles/rails_7.0.gemfile".freeze, "lib/generators/operation/USAGE".freeze, "lib/generators/operation/operation_generator.rb".freeze, "lib/generators/operation/templates/controller.erb".freeze, "lib/generators/operation/templates/create.erb".freeze, "lib/generators/operation/templates/destroy.erb".freeze, "lib/generators/operation/templates/load.erb".freeze, "lib/generators/operation/templates/update.erb".freeze, "lib/generators/operation/templates/view.erb".freeze, "lib/rails_ops.rb".freeze, "lib/rails_ops/authorization_backend/abstract.rb".freeze, "lib/rails_ops/authorization_backend/can_can_can.rb".freeze, "lib/rails_ops/configuration.rb".freeze, "lib/rails_ops/context.rb".freeze, "lib/rails_ops/controller_mixin.rb".freeze, "lib/rails_ops/exceptions.rb".freeze, "lib/rails_ops/hooked_job.rb".freeze, "lib/rails_ops/hookup.rb".freeze, "lib/rails_ops/hookup/dsl.rb".freeze, "lib/rails_ops/hookup/dsl_validator.rb".freeze, "lib/rails_ops/hookup/hook.rb".freeze, "lib/rails_ops/log_subscriber.rb".freeze, "lib/rails_ops/mixins.rb".freeze, "lib/rails_ops/mixins/authorization.rb".freeze, "lib/rails_ops/mixins/log_settings.rb".freeze, "lib/rails_ops/mixins/model.rb".freeze, "lib/rails_ops/mixins/model/authorization.rb".freeze, "lib/rails_ops/mixins/model/nesting.rb".freeze, "lib/rails_ops/mixins/param_authorization.rb".freeze, "lib/rails_ops/mixins/policies.rb".freeze, "lib/rails_ops/mixins/require_context.rb".freeze, "lib/rails_ops/mixins/routes.rb".freeze, "lib/rails_ops/mixins/schema_validation.rb".freeze, "lib/rails_ops/mixins/sub_ops.rb".freeze, "lib/rails_ops/model_casting.rb".freeze, "lib/rails_ops/model_mixins.rb".freeze, "lib/rails_ops/model_mixins/ar_extension.rb".freeze, "lib/rails_ops/model_mixins/parent_op.rb".freeze, "lib/rails_ops/model_mixins/sti_fixes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes.rb".freeze, "lib/rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb".freeze, "lib/rails_ops/model_mixins/virtual_has_one.rb".freeze, "lib/rails_ops/model_mixins/virtual_model_name.rb".freeze, "lib/rails_ops/operation.rb".freeze, "lib/rails_ops/operation/model.rb".freeze, "lib/rails_ops/operation/model/create.rb".freeze, "lib/rails_ops/operation/model/destroy.rb".freeze, "lib/rails_ops/operation/model/load.rb".freeze, "lib/rails_ops/operation/model/update.rb".freeze, "lib/rails_ops/patches/active_type_patch.rb".freeze, "lib/rails_ops/profiler.rb".freeze, "lib/rails_ops/profiler/node.rb".freeze, "lib/rails_ops/railtie.rb".freeze, "lib/rails_ops/scoped_env.rb".freeze, "lib/rails_ops/virtual_model.rb".freeze, "rails_ops.gemspec".freeze, "test/db/models.rb".freeze, "test/db/schema.rb".freeze, "test/dummy/Rakefile".freeze, "test/dummy/app/assets/config/manifest.js".freeze, "test/dummy/app/assets/images/.keep".freeze, "test/dummy/app/assets/javascripts/application.js".freeze, "test/dummy/app/assets/javascripts/cable.js".freeze, "test/dummy/app/assets/javascripts/channels/.keep".freeze, "test/dummy/app/assets/stylesheets/application.css".freeze, "test/dummy/app/channels/application_cable/channel.rb".freeze, "test/dummy/app/channels/application_cable/connection.rb".freeze, "test/dummy/app/controllers/application_controller.rb".freeze, "test/dummy/app/controllers/concerns/.keep".freeze, "test/dummy/app/helpers/application_helper.rb".freeze, "test/dummy/app/jobs/application_job.rb".freeze, "test/dummy/app/mailers/application_mailer.rb".freeze, "test/dummy/app/models/animal.rb".freeze, "test/dummy/app/models/application_record.rb".freeze, "test/dummy/app/models/bird.rb".freeze, "test/dummy/app/models/cat.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/dog.rb".freeze, "test/dummy/app/models/flower.rb".freeze, "test/dummy/app/models/group.rb".freeze, "test/dummy/app/models/nightingale.rb".freeze, "test/dummy/app/models/phoenix.rb".freeze, "test/dummy/app/models/user.rb".freeze, "test/dummy/app/views/layouts/application.html.erb".freeze, "test/dummy/app/views/layouts/mailer.html.erb".freeze, "test/dummy/app/views/layouts/mailer.text.erb".freeze, "test/dummy/bin/bundle".freeze, "test/dummy/bin/rails".freeze, "test/dummy/bin/rake".freeze, "test/dummy/bin/setup".freeze, "test/dummy/bin/update".freeze, "test/dummy/bin/yarn".freeze, "test/dummy/config.ru".freeze, "test/dummy/config/application.rb".freeze, "test/dummy/config/boot.rb".freeze, "test/dummy/config/cable.yml".freeze, "test/dummy/config/database.yml".freeze, "test/dummy/config/environment.rb".freeze, "test/dummy/config/environments/development.rb".freeze, "test/dummy/config/environments/production.rb".freeze, "test/dummy/config/environments/test.rb".freeze, "test/dummy/config/initializers/application_controller_renderer.rb".freeze, "test/dummy/config/initializers/assets.rb".freeze, "test/dummy/config/initializers/backtrace_silencers.rb".freeze, "test/dummy/config/initializers/cookies_serializer.rb".freeze, "test/dummy/config/initializers/filter_parameter_logging.rb".freeze, "test/dummy/config/initializers/inflections.rb".freeze, "test/dummy/config/initializers/mime_types.rb".freeze, "test/dummy/config/initializers/rails_ops.rb".freeze, "test/dummy/config/initializers/wrap_parameters.rb".freeze, "test/dummy/config/locales/en.yml".freeze, "test/dummy/config/puma.rb".freeze, "test/dummy/config/routes.rb".freeze, "test/dummy/config/secrets.yml".freeze, "test/dummy/config/spring.rb".freeze, "test/dummy/db/schema.rb".freeze, "test/dummy/lib/assets/.keep".freeze, "test/dummy/log/.keep".freeze, "test/dummy/package.json".freeze, "test/dummy/public/404.html".freeze, "test/dummy/public/422.html".freeze, "test/dummy/public/500.html".freeze, "test/dummy/public/apple-touch-icon-precomposed.png".freeze, "test/dummy/public/apple-touch-icon.png".freeze, "test/dummy/public/favicon.ico".freeze, "test/dummy/tmp/.keep".freeze, "test/test_helper.rb".freeze, "test/unit/rails_ops/generators/operation_generator_test.rb".freeze, "test/unit/rails_ops/mixins/model/nesting.rb".freeze, "test/unit/rails_ops/mixins/policies_test.rb".freeze, "test/unit/rails_ops/operation/model/create_test.rb".freeze, "test/unit/rails_ops/operation/model/load_test.rb".freeze, "test/unit/rails_ops/operation/model/sti_test.rb".freeze, "test/unit/rails_ops/operation/model/update_test.rb".freeze, "test/unit/rails_ops/operation/model_test.rb".freeze, "test/unit/rails_ops/operation/update_auth_test.rb".freeze, "test/unit/rails_ops/operation/update_lazy_auth_test.rb".freeze, "test/unit/rails_ops/operation_test.rb".freeze]
|
13
13
|
s.rubygems_version = "3.2.15".freeze
|
14
14
|
s.summary = "An operations service layer for rails projects.".freeze
|
@@ -125,6 +125,90 @@ class OperationGeneratorTest < Rails::Generators::TestCase
|
|
125
125
|
assert_routes
|
126
126
|
end
|
127
127
|
|
128
|
+
def test_module_name
|
129
|
+
optiongroups = [['User', '--module=Admin'], ['User', '--module=admin']]
|
130
|
+
|
131
|
+
optiongroups.each do |optiongroup|
|
132
|
+
run_generator optiongroup
|
133
|
+
|
134
|
+
# Check that namespaced operations are generated
|
135
|
+
assert_file 'app/operations/admin/user/create.rb' do |operation|
|
136
|
+
assert_match(/module Operations::Admin::User/, operation)
|
137
|
+
assert_match(/class Create < RailsOps::Operation::Model::Create/, operation)
|
138
|
+
assert_match(/model ::User/, operation)
|
139
|
+
end
|
140
|
+
assert_file 'app/operations/admin/user/destroy.rb' do |operation|
|
141
|
+
assert_match(/module Operations::Admin::User/, operation)
|
142
|
+
assert_match(/class Destroy < RailsOps::Operation::Model::Destroy/, operation)
|
143
|
+
assert_match(/model ::User/, operation)
|
144
|
+
end
|
145
|
+
assert_file 'app/operations/admin/user/load.rb' do |operation|
|
146
|
+
assert_match(/module Operations::Admin::User/, operation)
|
147
|
+
assert_match(/class Load < RailsOps::Operation::Model::Load/, operation)
|
148
|
+
assert_match(/model ::User/, operation)
|
149
|
+
end
|
150
|
+
assert_file 'app/operations/admin/user/update.rb' do |operation|
|
151
|
+
assert_match(/module Operations::Admin::User/, operation)
|
152
|
+
assert_match(/class Update < RailsOps::Operation::Model::Update/, operation)
|
153
|
+
assert_match(/model ::User/, operation)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Check that views are generated
|
157
|
+
%w(index show new edit).each do |view|
|
158
|
+
assert_file "app/views/admin/users/#{view}.html.haml"
|
159
|
+
end
|
160
|
+
|
161
|
+
# Check that the controller is generated
|
162
|
+
assert_file 'app/controllers/admin/users_controller.rb' do |controller|
|
163
|
+
assert_match(/module Admin/, controller)
|
164
|
+
assert_match(/class UsersController < ApplicationController/, controller)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Check that the routes entry is added
|
168
|
+
assert_routes
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_nested_module_name
|
173
|
+
run_generator ['User', '--module=admin/foo']
|
174
|
+
|
175
|
+
# Check that namespaced operations are generated
|
176
|
+
assert_file 'app/operations/admin/foo/user/create.rb' do |operation|
|
177
|
+
assert_match(/module Operations::Admin::Foo::User/, operation)
|
178
|
+
assert_match(/class Create < RailsOps::Operation::Model::Create/, operation)
|
179
|
+
assert_match(/model ::User/, operation)
|
180
|
+
end
|
181
|
+
assert_file 'app/operations/admin/foo/user/destroy.rb' do |operation|
|
182
|
+
assert_match(/module Operations::Admin::Foo::User/, operation)
|
183
|
+
assert_match(/class Destroy < RailsOps::Operation::Model::Destroy/, operation)
|
184
|
+
assert_match(/model ::User/, operation)
|
185
|
+
end
|
186
|
+
assert_file 'app/operations/admin/foo/user/load.rb' do |operation|
|
187
|
+
assert_match(/module Operations::Admin::Foo::User/, operation)
|
188
|
+
assert_match(/class Load < RailsOps::Operation::Model::Load/, operation)
|
189
|
+
assert_match(/model ::User/, operation)
|
190
|
+
end
|
191
|
+
assert_file 'app/operations/admin/foo/user/update.rb' do |operation|
|
192
|
+
assert_match(/module Operations::Admin::Foo::User/, operation)
|
193
|
+
assert_match(/class Update < RailsOps::Operation::Model::Update/, operation)
|
194
|
+
assert_match(/model ::User/, operation)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Check that views are generated
|
198
|
+
%w(index show new edit).each do |view|
|
199
|
+
assert_file "app/views/admin/foo/users/#{view}.html.haml"
|
200
|
+
end
|
201
|
+
|
202
|
+
# Check that the controller is generated
|
203
|
+
assert_file 'app/controllers/admin/foo/users_controller.rb' do |controller|
|
204
|
+
assert_match(/module Admin::Foo/, controller)
|
205
|
+
assert_match(/class UsersController < ApplicationController/, controller)
|
206
|
+
end
|
207
|
+
|
208
|
+
# Check that the routes entry is added
|
209
|
+
assert_routes
|
210
|
+
end
|
211
|
+
|
128
212
|
private
|
129
213
|
|
130
214
|
def assert_operations
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_ops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|