base_editing_bootstrap 0.8.0 → 0.9.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6c6f28177733d11676c8d4a02244cc35ecd6bdcd781810f5b8684e4d437740
|
4
|
+
data.tar.gz: e74338339bd8cbb23c41c3ab297305b0808bc7330e28d5007b7b333e1aa04273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97129ae0001d5db7495a0f6001c6aeca698e226aeb78931296e0e14766f3fb4f11d8f138b881232668cc1703a76e6806ce0fd30f578d0764fd6bbb3cdf2cc661
|
7
|
+
data.tar.gz: d0925d777f781941e8951e34d8d83710f2459da0cbba0f9354902cd4a5498bd3da49ceb978cf99bb1bd440f603593e6bec63a1d5d5f6fa1fa439ac465dcb3fe3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
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.1 - 2024-06-17
|
6
|
+
#### Bug Fixes
|
7
|
+
- Change http status check from symbol to number - (1ecd63d) - Marino Bonetti
|
8
|
+
|
9
|
+
- - -
|
10
|
+
|
11
|
+
## 0.9.0 - 2024-06-16
|
12
|
+
#### Features
|
13
|
+
- Change default and docs for show - (f320698) - Marino Bonetti
|
14
|
+
|
15
|
+
- - -
|
16
|
+
|
5
17
|
## 0.8.0 - 2024-06-12
|
6
18
|
#### Documentation
|
7
19
|
- 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
|
-
#
|
194
|
-
#
|
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
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.1
|
@@ -88,7 +88,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
88
88
|
it "response" do
|
89
89
|
params = {q: {"foo_eq": "foo"}}
|
90
90
|
get url_for_index, params: params
|
91
|
-
expect(response).to have_http_status(
|
91
|
+
expect(response).to have_http_status(200)
|
92
92
|
expect(assigns[:search_instance]).to be_an_instance_of(BaseEditingBootstrap::Searches::Base).and(have_attributes(
|
93
93
|
user: user,
|
94
94
|
params: ActionController::Parameters.new(params).permit!
|
@@ -101,7 +101,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
101
101
|
describe "new" do
|
102
102
|
it "response" do
|
103
103
|
get url_for_new
|
104
|
-
expect(response).to have_http_status(
|
104
|
+
expect(response).to have_http_status(200)
|
105
105
|
expect(assigns[:object]).to be_an_instance_of(model)
|
106
106
|
end
|
107
107
|
end
|
@@ -111,7 +111,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
111
111
|
describe "edit" do
|
112
112
|
it "response" do
|
113
113
|
get url_for_edit.call
|
114
|
-
expect(response).to have_http_status(
|
114
|
+
expect(response).to have_http_status(200)
|
115
115
|
expect(assigns[:object]).to be_an_instance_of(model)
|
116
116
|
end
|
117
117
|
end
|
@@ -122,7 +122,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
122
122
|
it "response" do
|
123
123
|
put url_for_update, params: {param_key => valid_attributes}
|
124
124
|
expect(assigns[:object]).to be_an_instance_of(model)
|
125
|
-
expect(response).to have_http_status(
|
125
|
+
expect(response).to have_http_status(303)
|
126
126
|
case BaseEditingBootstrap.after_success_update_redirect
|
127
127
|
when :index
|
128
128
|
expect(response).to redirect_to(url_for_index)
|
@@ -135,7 +135,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
135
135
|
unless skip_invalid_checks
|
136
136
|
it "not valid" do
|
137
137
|
put url_for_update, params: {param_key => invalid_attributes}
|
138
|
-
expect(response).to have_http_status(
|
138
|
+
expect(response).to have_http_status(422)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -146,7 +146,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
146
146
|
it "response" do
|
147
147
|
post url_for_create, params: {param_key => valid_attributes}
|
148
148
|
expect(assigns[:object]).to be_an_instance_of(model)
|
149
|
-
expect(response).to have_http_status(
|
149
|
+
expect(response).to have_http_status(303)
|
150
150
|
case BaseEditingBootstrap.after_success_create_redirect
|
151
151
|
when :index
|
152
152
|
expect(response).to redirect_to(url_for_index)
|
@@ -159,7 +159,7 @@ RSpec.shared_examples "base editing controller" do |factory: nil, only: [], exce
|
|
159
159
|
unless skip_invalid_checks
|
160
160
|
it "not valid" do
|
161
161
|
post url_for_create, params: {param_key => invalid_attributes}
|
162
|
-
expect(response).to have_http_status(
|
162
|
+
expect(response).to have_http_status(422)
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
@@ -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?,
|
24
|
-
[:destroy?,
|
25
|
-
[:update?,
|
26
|
-
[:create?,
|
27
|
-
[:index?,
|
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.
|
4
|
+
version: 0.9.1
|
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-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|