rails_ops 1.1.20 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +27 -0
- data/CHANGELOG.md +12 -0
- data/README.md +55 -14
- data/Rakefile +3 -0
- data/VERSION +1 -1
- data/lib/rails_ops/authorization_backend/can_can_can.rb +1 -1
- data/lib/rails_ops/mixins/model/authorization.rb +3 -1
- data/lib/rails_ops/mixins/model/nesting.rb +0 -1
- data/lib/rails_ops/model_mixins/sti_fixes.rb +21 -0
- data/lib/rails_ops/model_mixins/virtual_model_name.rb +9 -0
- data/lib/rails_ops/model_mixins.rb +1 -0
- data/lib/rails_ops/operation/model/update.rb +17 -2
- data/lib/rails_ops/operation/model.rb +5 -0
- data/lib/rails_ops.rb +1 -0
- data/rails_ops.gemspec +12 -6
- data/test/dummy/app/models/animal.rb +1 -0
- data/test/dummy/app/models/bird.rb +1 -0
- data/test/dummy/app/models/cat.rb +1 -0
- data/test/dummy/app/models/dog.rb +1 -0
- data/test/dummy/app/models/nightingale.rb +1 -0
- data/test/dummy/app/models/phoenix.rb +1 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/config/application.rb +12 -1
- data/test/dummy/config/environments/test.rb +1 -1
- data/test/dummy/config/initializers/backtrace_silencers.rb +1 -1
- data/test/dummy/db/schema.rb +4 -0
- data/test/test_helper.rb +2 -0
- data/test/unit/rails_ops/operation/model/sti_test.rb +70 -0
- data/test/unit/rails_ops/operation/update_auth_test.rb +62 -0
- data/test/unit/rails_ops/operation/update_lazy_auth_test.rb +63 -0
- metadata +67 -4
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f5db505fe961fecc4e9723b857f989860cf5056d76eb9814a4d4903bb0a6bfe
|
4
|
+
data.tar.gz: 3ab7053bc62a8bfb77b8c81ac90c97467ccdde7778e906097c4328c68c47607c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91c83b59903d7b82539e04c87a4604b6878a8f837a89931f95dcbf542d209e446e3caa849825f5042be68d0c95277f888445438f44ac7e9971f8140d02b4f124
|
7
|
+
data.tar.gz: 80c4f9044744f71f34c07b70c73b584d74fad04d958db6055246d7d13aeb592a1a8bdae58ee258ae1f1513f325b2f9978e1ed50cf14dbe50f560dbc3899c532c
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['2.3.0', '2.5.1', '2.6.2', '2.7.1', '3.0.1']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Run rake tests
|
25
|
+
run: bundle exec rake test
|
26
|
+
- name: Run rubocop
|
27
|
+
run: bundle exec rubocop
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.1.22 (2021-11-25)
|
4
|
+
|
5
|
+
* Add support for STI in model operations
|
6
|
+
|
7
|
+
## 1.1.21 (2021-11-01)
|
8
|
+
|
9
|
+
* Add support for lazy model authorization
|
10
|
+
|
11
|
+
## 1.1.21 (2021-06-23)
|
12
|
+
|
13
|
+
* Fix using model operations in conjunction with Single Table Inheritance (STI)
|
14
|
+
|
3
15
|
## 1.1.20 (2021-02-18)
|
4
16
|
|
5
17
|
* Fix warnings with Ruby 2.7
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://github.com/sitrox/rails_ops/actions/workflows/ruby.yml)
|
2
2
|
[](https://badge.fury.io/rb/rails_ops)
|
3
3
|
|
4
4
|
rails_ops
|
@@ -988,24 +988,18 @@ class Operations::User::Load < RailsOps::Operation::Model::Load
|
|
988
988
|
model User
|
989
989
|
end
|
990
990
|
|
991
|
-
op = Operations::User::Load.run!(id: 5)
|
992
|
-
op.model.id # => 5
|
993
|
-
```
|
994
|
-
|
995
|
-
Note that this base class is a bit of a special case: It does not provide a
|
996
|
-
`perform` method and does not need to be run at all in order to load a model.
|
997
|
-
This is very useful when, for example, displaying a form based on a model
|
998
|
-
instance without actually performing any particular action such as updating a
|
999
|
-
model.
|
1000
|
-
|
1001
|
-
Therefore, the above example would also work as follows:
|
1002
|
-
|
1003
|
-
```ruby
|
1004
991
|
# The operation does not have to be performed to access the model instance.
|
1005
992
|
op = Operations::User::Load.new(id: 5)
|
1006
993
|
op.model.id # => 5
|
1007
994
|
```
|
1008
995
|
|
996
|
+
Note that this base class is a bit of a special case: It does not provide an
|
997
|
+
implementation of the `perform` method and does not need to be run at all in
|
998
|
+
order to load a model (in fact, it cannot be run unless you override the
|
999
|
+
`perform` method). This is very useful when, for example, displaying a form
|
1000
|
+
based on a model instance without actually performing any particular action such
|
1001
|
+
as updating a model.
|
1002
|
+
|
1009
1003
|
#### Specifying ID field
|
1010
1004
|
|
1011
1005
|
Per default, the model instance is looked up using the field `id` and the ID
|
@@ -1195,6 +1189,25 @@ end
|
|
1195
1189
|
Note that using the different model base classes, this is already set to a
|
1196
1190
|
sensible default. See the respective class' source code for details.
|
1197
1191
|
|
1192
|
+
#### Lazy model update authorization
|
1193
|
+
|
1194
|
+
In case of operations inheriting from `RailsOps::Operation::Model::Update`, you
|
1195
|
+
can specify the `model_authorization_action` to be `lazy`, meaning that it will
|
1196
|
+
only be checked when *performing* the operation, but not on initialization. This
|
1197
|
+
can be useful for displaying readonly forms to users which have read-permissions
|
1198
|
+
only:
|
1199
|
+
|
1200
|
+
```ruby
|
1201
|
+
class Operations::User::Update < RailsOps::Operation::Model::Update
|
1202
|
+
model User
|
1203
|
+
|
1204
|
+
# This automatically calls `authorize_model! :read`. Because it is set to be
|
1205
|
+
# `lazy`, the authorization will only run when the operation is actually
|
1206
|
+
# *performed*, and not already at instantiation.
|
1207
|
+
model_authorization_action :update, lazy: true
|
1208
|
+
end
|
1209
|
+
```
|
1210
|
+
|
1198
1211
|
### Model nesting
|
1199
1212
|
|
1200
1213
|
Using active record, multiple nested models can be saved at once by using
|
@@ -1257,6 +1270,34 @@ This block receives the params hash as it would be passed to the sub operation
|
|
1257
1270
|
and allows to modify it. The block's return value is then passed to the
|
1258
1271
|
sub-operation. Do not change the params inplace but instead return a new hash.
|
1259
1272
|
|
1273
|
+
### Single-table inheritance
|
1274
|
+
|
1275
|
+
Model operations also support STI models (Single Table Inheritance). However,
|
1276
|
+
there is the caviat that if you do extend your model in the operation (e.g.
|
1277
|
+
`model Animal do { ... }`), RailsOps automatically creates an anonymous subclass
|
1278
|
+
of the given class (e.g. `Animal`). Operations will always load / create models
|
1279
|
+
that are instances of this anonymous class.
|
1280
|
+
|
1281
|
+
Consider the following operation:
|
1282
|
+
|
1283
|
+
```ruby
|
1284
|
+
class Animal < ApplicationRecord; end
|
1285
|
+
class Bird < Animal; end
|
1286
|
+
class Mouse < Animal; end
|
1287
|
+
|
1288
|
+
class LoadAnimal < RailsOps::Operation::Model::Load
|
1289
|
+
model Animal do
|
1290
|
+
# Something
|
1291
|
+
end
|
1292
|
+
end
|
1293
|
+
|
1294
|
+
bird = Bird.create
|
1295
|
+
op_bird = LoadAnimal.new(id: bird.id)
|
1296
|
+
|
1297
|
+
bird.class # => Class "Bird", extending "Animal"
|
1298
|
+
op_bird.class # => Anonymous class, extending "Animal", not "Bird"
|
1299
|
+
```
|
1300
|
+
|
1260
1301
|
Record extension and virtual records
|
1261
1302
|
------------------------------------
|
1262
1303
|
|
data/Rakefile
CHANGED
@@ -18,6 +18,9 @@ task :gemspec do
|
|
18
18
|
spec.add_development_dependency 'bundler'
|
19
19
|
spec.add_development_dependency 'rake'
|
20
20
|
spec.add_development_dependency 'sqlite3'
|
21
|
+
spec.add_development_dependency 'cancancan'
|
22
|
+
spec.add_development_dependency 'pry'
|
23
|
+
spec.add_development_dependency 'colorize'
|
21
24
|
spec.add_development_dependency 'rubocop', '0.47.1'
|
22
25
|
spec.add_dependency 'active_type', '>= 1.3.0'
|
23
26
|
spec.add_dependency 'minitest'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.24
|
@@ -6,13 +6,15 @@ module RailsOps::Mixins::Model::Authorization
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
class_attribute :_model_authorization_action
|
9
|
+
class_attribute :_model_authorization_lazy
|
9
10
|
end
|
10
11
|
|
11
12
|
module ClassMethods
|
12
13
|
# Gets or sets the action verb used for authorizing models.
|
13
|
-
def model_authorization_action(*action)
|
14
|
+
def model_authorization_action(*action, lazy: false)
|
14
15
|
if action.size == 1
|
15
16
|
self._model_authorization_action = action.first
|
17
|
+
self._model_authorization_lazy = lazy
|
16
18
|
elsif action.size > 1
|
17
19
|
fail ArgumentError, 'Too many arguments'
|
18
20
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module RailsOps
|
2
|
+
module ModelMixins
|
3
|
+
module StiFixes
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
class_methods do
|
7
|
+
def finder_needs_type_condition?
|
8
|
+
superclass.finder_needs_type_condition?
|
9
|
+
end
|
10
|
+
|
11
|
+
def descendants
|
12
|
+
superclass.descendants
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
superclass.name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -5,12 +5,21 @@ module RailsOps
|
|
5
5
|
|
6
6
|
included do
|
7
7
|
class_attribute :virtual_model_name
|
8
|
+
class_attribute :virtual_sti_name
|
8
9
|
end
|
9
10
|
|
10
11
|
module ClassMethods
|
11
12
|
def model_name
|
12
13
|
virtual_model_name || super
|
13
14
|
end
|
15
|
+
|
16
|
+
def sti_name
|
17
|
+
virtual_sti_name || super
|
18
|
+
end
|
19
|
+
|
20
|
+
def find_sti_class(_type_name)
|
21
|
+
self
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
end
|
@@ -8,5 +8,6 @@ module RailsOps::ModelMixins
|
|
8
8
|
include VirtualAttributes # Provides virtual attributes functionality.
|
9
9
|
include VirtualHasOne # Provides virtual_has_one.
|
10
10
|
include VirtualModelName # Provides virtual_model_name.
|
11
|
+
include StiFixes # Fixes using RailsOps models with STI.
|
11
12
|
end
|
12
13
|
end
|
@@ -7,14 +7,29 @@ class RailsOps::Operation::Model::Update < RailsOps::Operation::Model::Load
|
|
7
7
|
true
|
8
8
|
end
|
9
9
|
|
10
|
+
policy :before_perform do
|
11
|
+
if model_authorization_action && self.class._model_authorization_lazy
|
12
|
+
authorize_model! model_authorization_action, model
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
def model_authorization
|
11
17
|
return unless authorization_enabled?
|
12
18
|
|
13
|
-
|
19
|
+
if self.class._model_authorization_lazy
|
20
|
+
if load_model_authorization_action.nil?
|
21
|
+
fail RailsOps::Exceptions::NoAuthorizationPerformed,
|
22
|
+
"Operation #{self.class.name} must specify a "\
|
23
|
+
'load_model_authorization_action because model '\
|
24
|
+
'authorization is configured to be lazy.'
|
25
|
+
else
|
26
|
+
authorize_model! load_model_authorization_action, model
|
27
|
+
end
|
28
|
+
elsif !load_model_authorization_action.nil?
|
14
29
|
authorize_model_with_authorize_only! load_model_authorization_action, model
|
15
30
|
end
|
16
31
|
|
17
|
-
unless model_authorization_action.nil?
|
32
|
+
unless model_authorization_action.nil? || self.class._model_authorization_lazy
|
18
33
|
authorize_model! model_authorization_action, model
|
19
34
|
end
|
20
35
|
end
|
@@ -69,6 +69,11 @@ class RailsOps::Operation::Model < RailsOps::Operation
|
|
69
69
|
_model_class.virtual_model_name = ActiveModel::Name.new(_model_class, nil, name.to_s)
|
70
70
|
end
|
71
71
|
|
72
|
+
# Set virtual STI name if given.
|
73
|
+
if model_class && model_class.name
|
74
|
+
_model_class.virtual_sti_name = model_class.name
|
75
|
+
end
|
76
|
+
|
72
77
|
# ---------------------------------------------------------------
|
73
78
|
# We just use the given model class without any adaptions
|
74
79
|
# ---------------------------------------------------------------
|
data/lib/rails_ops.rb
CHANGED
@@ -88,6 +88,7 @@ require 'rails_ops/model_casting.rb'
|
|
88
88
|
require 'rails_ops/model_mixins.rb'
|
89
89
|
require 'rails_ops/model_mixins/ar_extension.rb'
|
90
90
|
require 'rails_ops/model_mixins/parent_op.rb'
|
91
|
+
require 'rails_ops/model_mixins/sti_fixes.rb'
|
91
92
|
require 'rails_ops/model_mixins/virtual_attributes.rb'
|
92
93
|
require 'rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb'
|
93
94
|
require 'rails_ops/model_mixins/virtual_has_one.rb'
|
data/rails_ops.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: rails_ops 1.1.
|
2
|
+
# stub: rails_ops 1.1.24 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.24"
|
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 = "2021-
|
12
|
-
s.files = [".
|
13
|
-
s.rubygems_version = "3.
|
11
|
+
s.date = "2021-11-25"
|
12
|
+
s.files = [".github/workflows/ruby.yml".freeze, ".gitignore".freeze, ".releaser_config".freeze, ".rubocop.yml".freeze, "CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".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/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/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
|
+
s.rubygems_version = "3.2.22".freeze
|
14
14
|
s.summary = "An operations service layer for rails projects.".freeze
|
15
|
-
s.test_files = ["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/application_record.rb".freeze, "test/dummy/app/models/concerns/.keep".freeze, "test/dummy/app/models/group.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/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/update_test.rb".freeze, "test/unit/rails_ops/operation/model_test.rb".freeze, "test/unit/rails_ops/operation_test.rb".freeze]
|
15
|
+
s.test_files = ["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/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/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]
|
16
16
|
|
17
17
|
if s.respond_to? :specification_version then
|
18
18
|
s.specification_version = 4
|
@@ -22,6 +22,9 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
23
23
|
s.add_development_dependency(%q<rake>.freeze, [">= 0"])
|
24
24
|
s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
|
25
|
+
s.add_development_dependency(%q<cancancan>.freeze, [">= 0"])
|
26
|
+
s.add_development_dependency(%q<pry>.freeze, [">= 0"])
|
27
|
+
s.add_development_dependency(%q<colorize>.freeze, [">= 0"])
|
25
28
|
s.add_development_dependency(%q<rubocop>.freeze, ["= 0.47.1"])
|
26
29
|
s.add_runtime_dependency(%q<active_type>.freeze, [">= 1.3.0"])
|
27
30
|
s.add_runtime_dependency(%q<minitest>.freeze, [">= 0"])
|
@@ -32,6 +35,9 @@ Gem::Specification.new do |s|
|
|
32
35
|
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
33
36
|
s.add_dependency(%q<rake>.freeze, [">= 0"])
|
34
37
|
s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
|
38
|
+
s.add_dependency(%q<cancancan>.freeze, [">= 0"])
|
39
|
+
s.add_dependency(%q<pry>.freeze, [">= 0"])
|
40
|
+
s.add_dependency(%q<colorize>.freeze, [">= 0"])
|
35
41
|
s.add_dependency(%q<rubocop>.freeze, ["= 0.47.1"])
|
36
42
|
s.add_dependency(%q<active_type>.freeze, [">= 1.3.0"])
|
37
43
|
s.add_dependency(%q<minitest>.freeze, [">= 0"])
|
@@ -0,0 +1 @@
|
|
1
|
+
class Animal < ApplicationRecord; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class Bird < Animal; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class Cat < Animal; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class Dog < Animal; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class Nightingale < Bird; end
|
@@ -0,0 +1 @@
|
|
1
|
+
class Phoenix < Bird; end
|
@@ -1,6 +1,17 @@
|
|
1
1
|
require_relative 'boot'
|
2
2
|
|
3
|
-
require 'rails
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
# require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
require "action_mailer/railtie"
|
11
|
+
require "action_view/railtie"
|
12
|
+
require "action_cable/engine"
|
13
|
+
require "sprockets/railtie"
|
14
|
+
require "rails/test_unit/railtie"
|
4
15
|
|
5
16
|
Bundler.require(*Rails.groups)
|
6
17
|
require 'rails_ops'
|
@@ -10,7 +10,7 @@ Rails.application.configure do
|
|
10
10
|
# Do not eager load code on boot. This avoids loading your whole application
|
11
11
|
# just for the purpose of running a single test. If you are using a tool that
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load =
|
13
|
+
config.eager_load = true
|
14
14
|
|
15
15
|
# Configure public file server for tests with Cache-Control for performance.
|
16
16
|
config.public_file_server.enabled = true
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
5
|
|
6
6
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
data/test/dummy/db/schema.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
|
2
2
|
# ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
3
3
|
require 'rails/test_help'
|
4
|
+
require 'pry'
|
5
|
+
require 'colorize'
|
4
6
|
|
5
7
|
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
6
8
|
# to be shown.
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RailsOps::Operation::Model::StiTest < ActiveSupport::TestCase
|
4
|
+
include TestHelper
|
5
|
+
|
6
|
+
setup do
|
7
|
+
@dog = Dog.create!
|
8
|
+
@cat = Cat.create!
|
9
|
+
@phoenix = Phoenix.create!
|
10
|
+
@nightingale = Nightingale.create!
|
11
|
+
end
|
12
|
+
|
13
|
+
LOAD_ANIMAL_OP = Class.new(RailsOps::Operation::Model::Load) do
|
14
|
+
model Animal do
|
15
|
+
attribute :my_virtual_animal_name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
LOAD_DOG_OP = Class.new(RailsOps::Operation::Model::Load) do
|
20
|
+
model Dog do
|
21
|
+
attribute :my_virtual_dog_name
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
LOAD_BIRD_OP = Class.new(RailsOps::Operation::Model::Load) do
|
26
|
+
model Bird do
|
27
|
+
attribute :my_virtual_bird_name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
LOAD_PHOENIX_OP = Class.new(RailsOps::Operation::Model::Load) do
|
32
|
+
model Phoenix do
|
33
|
+
attribute :my_virtual_phoenix_name
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_load_animal
|
38
|
+
model = LOAD_ANIMAL_OP.new(id: @dog.id).model
|
39
|
+
assert_equal 'Dog', model.type
|
40
|
+
assert model.is_a?(LOAD_ANIMAL_OP.model)
|
41
|
+
assert_nothing_raised { model.my_virtual_animal_name = 'Lenny' }
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_load_dog
|
45
|
+
model = LOAD_DOG_OP.new(id: @dog.id).model
|
46
|
+
|
47
|
+
assert_equal 'Dog', model.type
|
48
|
+
assert model.is_a?(LOAD_DOG_OP.model)
|
49
|
+
assert_nothing_raised { model.my_virtual_dog_name = 'Lenny' }
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_load_birds
|
53
|
+
phoenix = LOAD_BIRD_OP.new(id: @phoenix.id).model
|
54
|
+
nightingale = LOAD_BIRD_OP.new(id: @nightingale.id).model
|
55
|
+
|
56
|
+
assert_equal 'Phoenix', phoenix.type
|
57
|
+
assert phoenix.is_a?(LOAD_BIRD_OP.model)
|
58
|
+
assert nightingale.is_a?(LOAD_BIRD_OP.model)
|
59
|
+
assert_nothing_raised { phoenix.my_virtual_bird_name = 'Lenny' }
|
60
|
+
assert_nothing_raised { nightingale.my_virtual_bird_name = 'Lenny' }
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_load_phoenix
|
64
|
+
model = LOAD_PHOENIX_OP.new(id: @phoenix.id).model
|
65
|
+
|
66
|
+
assert_equal 'Phoenix', model.type
|
67
|
+
assert model.is_a?(LOAD_PHOENIX_OP.model)
|
68
|
+
assert_nothing_raised { model.my_virtual_phoenix_name = 'Lenny' }
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails_ops/authorization_backend/can_can_can'
|
3
|
+
require 'cancancan'
|
4
|
+
|
5
|
+
class RailsOps::Operation::UpdateLazyAuthTest < ActiveSupport::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
BASIC_OP = Class.new(RailsOps::Operation::Model::Update) do
|
9
|
+
model ::Group
|
10
|
+
|
11
|
+
model_authorization_action :update
|
12
|
+
|
13
|
+
def perform
|
14
|
+
fail osparams.exception if osparams.exception
|
15
|
+
@done = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ABILITY = Class.new do
|
20
|
+
include CanCan::Ability
|
21
|
+
|
22
|
+
def initialize(read: false, update: false)
|
23
|
+
can :read, Group if read
|
24
|
+
can :update, Group if update
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
setup do
|
29
|
+
Group.create!(id: 1, name: 'Group')
|
30
|
+
RailsOps.config.authorization_backend = 'RailsOps::AuthorizationBackend::CanCanCan'
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_unpermitted_read
|
34
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true))
|
35
|
+
assert_raises CanCan::AccessDenied do
|
36
|
+
BASIC_OP.new(ctx, id: 1)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_permitted_read
|
41
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true))
|
42
|
+
assert_nothing_raised do
|
43
|
+
BASIC_OP.new(ctx, id: 1)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_unpermitted_update
|
48
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true))
|
49
|
+
op = BASIC_OP.new(ctx, id: 1)
|
50
|
+
assert_raises CanCan::AccessDenied do
|
51
|
+
op.run!
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_permitted_update
|
56
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true, update: true))
|
57
|
+
op = BASIC_OP.new(ctx, id: 1)
|
58
|
+
assert_nothing_raised do
|
59
|
+
op.run!
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rails_ops/authorization_backend/can_can_can'
|
3
|
+
require 'cancancan'
|
4
|
+
|
5
|
+
class RailsOps::Operation::UpdateLazyAuthTest < ActiveSupport::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
BASIC_OP = Class.new(RailsOps::Operation::Model::Update) do
|
9
|
+
model ::Group
|
10
|
+
|
11
|
+
model_authorization_action :update, lazy: true
|
12
|
+
|
13
|
+
def perform
|
14
|
+
fail osparams.exception if osparams.exception
|
15
|
+
@done = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ABILITY = Class.new do
|
20
|
+
include CanCan::Ability
|
21
|
+
|
22
|
+
def initialize(read: false, update: false)
|
23
|
+
can :read, Group if read
|
24
|
+
can :update, Group if update
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
setup do
|
29
|
+
Group.delete_all
|
30
|
+
Group.create!(id: 1, name: 'Group')
|
31
|
+
RailsOps.config.authorization_backend = 'RailsOps::AuthorizationBackend::CanCanCan'
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_unpermitted_read
|
35
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new)
|
36
|
+
assert_raises CanCan::AccessDenied do
|
37
|
+
BASIC_OP.new(ctx, id: 1)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_permitted_read
|
42
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true))
|
43
|
+
assert_nothing_raised do
|
44
|
+
BASIC_OP.new(ctx, id: 1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_unpermitted_update
|
49
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true))
|
50
|
+
op = BASIC_OP.new(ctx, id: 1)
|
51
|
+
assert_raises CanCan::AccessDenied do
|
52
|
+
op.run!
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_permitted_update
|
57
|
+
ctx = RailsOps::Context.new(ability: ABILITY.new(read: true, update: true))
|
58
|
+
op = BASIC_OP.new(ctx, id: 1)
|
59
|
+
assert_nothing_raised do
|
60
|
+
op.run!
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
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.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sitrox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cancancan
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: colorize
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: rubocop
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,10 +190,10 @@ executables: []
|
|
148
190
|
extensions: []
|
149
191
|
extra_rdoc_files: []
|
150
192
|
files:
|
193
|
+
- ".github/workflows/ruby.yml"
|
151
194
|
- ".gitignore"
|
152
195
|
- ".releaser_config"
|
153
196
|
- ".rubocop.yml"
|
154
|
-
- ".travis.yml"
|
155
197
|
- CHANGELOG.md
|
156
198
|
- Gemfile
|
157
199
|
- LICENSE
|
@@ -187,6 +229,7 @@ files:
|
|
187
229
|
- lib/rails_ops/model_mixins.rb
|
188
230
|
- lib/rails_ops/model_mixins/ar_extension.rb
|
189
231
|
- lib/rails_ops/model_mixins/parent_op.rb
|
232
|
+
- lib/rails_ops/model_mixins/sti_fixes.rb
|
190
233
|
- lib/rails_ops/model_mixins/virtual_attributes.rb
|
191
234
|
- lib/rails_ops/model_mixins/virtual_attributes/virtual_column_wrapper.rb
|
192
235
|
- lib/rails_ops/model_mixins/virtual_has_one.rb
|
@@ -220,9 +263,16 @@ files:
|
|
220
263
|
- test/dummy/app/helpers/application_helper.rb
|
221
264
|
- test/dummy/app/jobs/application_job.rb
|
222
265
|
- test/dummy/app/mailers/application_mailer.rb
|
266
|
+
- test/dummy/app/models/animal.rb
|
223
267
|
- test/dummy/app/models/application_record.rb
|
268
|
+
- test/dummy/app/models/bird.rb
|
269
|
+
- test/dummy/app/models/cat.rb
|
224
270
|
- test/dummy/app/models/concerns/.keep
|
271
|
+
- test/dummy/app/models/dog.rb
|
225
272
|
- test/dummy/app/models/group.rb
|
273
|
+
- test/dummy/app/models/nightingale.rb
|
274
|
+
- test/dummy/app/models/phoenix.rb
|
275
|
+
- test/dummy/app/models/user.rb
|
226
276
|
- test/dummy/app/views/layouts/application.html.erb
|
227
277
|
- test/dummy/app/views/layouts/mailer.html.erb
|
228
278
|
- test/dummy/app/views/layouts/mailer.text.erb
|
@@ -271,8 +321,11 @@ files:
|
|
271
321
|
- test/unit/rails_ops/mixins/policies_test.rb
|
272
322
|
- test/unit/rails_ops/operation/model/create_test.rb
|
273
323
|
- test/unit/rails_ops/operation/model/load_test.rb
|
324
|
+
- test/unit/rails_ops/operation/model/sti_test.rb
|
274
325
|
- test/unit/rails_ops/operation/model/update_test.rb
|
275
326
|
- test/unit/rails_ops/operation/model_test.rb
|
327
|
+
- test/unit/rails_ops/operation/update_auth_test.rb
|
328
|
+
- test/unit/rails_ops/operation/update_lazy_auth_test.rb
|
276
329
|
- test/unit/rails_ops/operation_test.rb
|
277
330
|
homepage:
|
278
331
|
licenses: []
|
@@ -292,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
345
|
- !ruby/object:Gem::Version
|
293
346
|
version: '0'
|
294
347
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
348
|
+
rubygems_version: 3.2.22
|
296
349
|
signing_key:
|
297
350
|
specification_version: 4
|
298
351
|
summary: An operations service layer for rails projects.
|
@@ -313,9 +366,16 @@ test_files:
|
|
313
366
|
- test/dummy/app/helpers/application_helper.rb
|
314
367
|
- test/dummy/app/jobs/application_job.rb
|
315
368
|
- test/dummy/app/mailers/application_mailer.rb
|
369
|
+
- test/dummy/app/models/animal.rb
|
316
370
|
- test/dummy/app/models/application_record.rb
|
371
|
+
- test/dummy/app/models/bird.rb
|
372
|
+
- test/dummy/app/models/cat.rb
|
317
373
|
- test/dummy/app/models/concerns/.keep
|
374
|
+
- test/dummy/app/models/dog.rb
|
318
375
|
- test/dummy/app/models/group.rb
|
376
|
+
- test/dummy/app/models/nightingale.rb
|
377
|
+
- test/dummy/app/models/phoenix.rb
|
378
|
+
- test/dummy/app/models/user.rb
|
319
379
|
- test/dummy/app/views/layouts/application.html.erb
|
320
380
|
- test/dummy/app/views/layouts/mailer.html.erb
|
321
381
|
- test/dummy/app/views/layouts/mailer.text.erb
|
@@ -364,6 +424,9 @@ test_files:
|
|
364
424
|
- test/unit/rails_ops/mixins/policies_test.rb
|
365
425
|
- test/unit/rails_ops/operation/model/create_test.rb
|
366
426
|
- test/unit/rails_ops/operation/model/load_test.rb
|
427
|
+
- test/unit/rails_ops/operation/model/sti_test.rb
|
367
428
|
- test/unit/rails_ops/operation/model/update_test.rb
|
368
429
|
- test/unit/rails_ops/operation/model_test.rb
|
430
|
+
- test/unit/rails_ops/operation/update_auth_test.rb
|
431
|
+
- test/unit/rails_ops/operation/update_lazy_auth_test.rb
|
369
432
|
- test/unit/rails_ops/operation_test.rb
|