base_editing_bootstrap 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b1619def3100d40ea9c0af463dae74782d4a1a66b6b01fd823fb8a6fb4a7be0
4
- data.tar.gz: 81fb33920d91b1273f7055f6522552de71c0cb0098bae8b9af2e896fcbd21695
3
+ metadata.gz: 678f9ed5e165bf715f6e9523c7b9a29cd2d06ee4da800723a76b1efa61a5d747
4
+ data.tar.gz: 9a7e3297a6e03130d8cb2d1b769b91a37d20010a070fdab81dd0a029ddadfc65
5
5
  SHA512:
6
- metadata.gz: a22d5a35dfc17ff26c47373ee4815d8706f53dcf164f6fb9701c5855bfaa83b99f20be9e9e62c94f6acbcb6df36076b38d53a2d6589e6837271a7a4169daae3a
7
- data.tar.gz: dacc99dbc960c9e98170ce249238343036fdae23d7de23c4c439d3b0c80765168f6d0ad27a9de47b707663a130d865d5fd04100186f5440ca6573b3f28221aef
6
+ metadata.gz: 86c848f6f307910302465e1a7840f0046ab855ee60f7545f9ac68f004041d4176cff5370e02dd32d02b253a754756f0d2416de2783a1b47395d6d3ebac8cbc24
7
+ data.tar.gz: 7259712a03b75b24489ef7b459ac137eb7101d7e045e4bec175640b24509bcf875bc979a9bb91e23e7ecb1f977dfce14b40c6779be2fda2f39ebca587a14d328
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
  All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
3
3
 
4
4
  - - -
5
+ ## 0.9.0 - 2024-06-16
6
+ #### Features
7
+ - Change default and docs for show - (f320698) - Marino Bonetti
8
+
9
+ - - -
10
+
5
11
  ## 0.8.0 - 2024-06-12
6
12
  #### Documentation
7
13
  - Update Documentation - (1c7c723) - Marino Bonetti
data/README.md CHANGED
@@ -190,12 +190,20 @@ Policy
190
190
  require 'rails_helper'
191
191
  ##
192
192
  # - check_default_responses default false, to check default responses
193
- # TODO should be configurable
194
- # [:show?, false],
193
+ #
194
+ # on true all are true
195
+ # [:show?, true],
195
196
  # [:destroy?, true],
196
197
  # [:update?, true],
197
198
  # [:create?, true],
198
199
  # [:index?, true],
200
+ #
201
+ # when hash keys are:
202
+ # - show
203
+ # - destroy
204
+ # - update
205
+ # - create
206
+ # - index
199
207
  #
200
208
  RSpec.describe ServicePolicy, type: :policy do
201
209
  it_behaves_like "a standard base model policy", :service, check_default_responses: false
@@ -7,7 +7,7 @@ class BaseModelPolicy < ApplicationPolicy
7
7
 
8
8
  def destroy? = general_rule
9
9
 
10
- def show? = false
10
+ def show? = general_rule
11
11
 
12
12
  # Questo metodo può essere anche scritto specifico per azione:
13
13
  # - permitted_attributes_for_create
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.9.0
@@ -19,12 +19,47 @@ RSpec.shared_examples "a standard base model policy" do |factory, check_default_
19
19
 
20
20
  describe "standard_methods" do
21
21
  where(:method, :response) do
22
+
23
+ if check_default_responses == true
24
+ checks = {
25
+ show: true,
26
+ destroy: true,
27
+ update: true,
28
+ create: true,
29
+ index: true
30
+ }
31
+ elsif check_default_responses.is_a? Hash
32
+ checks = check_default_responses
33
+ elsif check_default_responses == false
34
+ checks = {}
35
+ else
36
+ raise <<-MESSAGE.strip_heredoc
37
+ Acceptable values for check_default_responses are:
38
+ - true
39
+ - false
40
+ - Hash with:
41
+ show
42
+ destroy
43
+ update
44
+ create
45
+ index
46
+ MESSAGE
47
+ end
48
+
49
+ checks.reverse_merge!(
50
+ show: true,
51
+ destroy: true,
52
+ update: true,
53
+ create: true,
54
+ index: true
55
+ )
56
+
22
57
  [
23
- [:show?, false],
24
- [:destroy?, true],
25
- [:update?, true],
26
- [:create?, true],
27
- [:index?, true],
58
+ [:show?, checks[:show]],
59
+ [:destroy?, checks[:destroy]],
60
+ [:update?, checks[:update]],
61
+ [:create?, checks[:create]],
62
+ [:index?, checks[:index]],
28
63
  ]
29
64
  end
30
65
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: base_editing_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails