auto_strong_parameters 0.0.2 → 0.0.3
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: 8d888930c9a1649b83470cc64c9c3d4d9477c9d520c3ac262bb9741b72b63f92
|
4
|
+
data.tar.gz: 4dfb6bc178a3b498c35288cf79f75c944e42ffe55a72a8f2603eb7d9f420d212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f3f4a17050f13d2310d0ac4909e6b570223f96bc3147860f389a464c454eb1738557f53d2b7d303b41c6071e28e5e294f21aab9b7b38ae8a750c1f2a600cac
|
7
|
+
data.tar.gz: 5fb38548e76beb1e9e88ac03b0cdcba3b5b819db598f54f08bcaca3665588c22fecff1fcb9450dd3ad346acd5032f1c5b6eb05669fac916d1600b344aad9a695
|
@@ -3,12 +3,12 @@
|
|
3
3
|
module AutoStrongParameters
|
4
4
|
module AutoPermit
|
5
5
|
def auto_permit!(key)
|
6
|
-
shape = asp_auto_permitted_params
|
6
|
+
shape = asp_auto_permitted_params
|
7
7
|
|
8
8
|
require(key).permit(shape[key])
|
9
9
|
end
|
10
10
|
|
11
|
-
def asp_auto_permitted_params
|
11
|
+
def asp_auto_permitted_params
|
12
12
|
if sig = self[AutoStrongParameters.asp_message_key]
|
13
13
|
AutoStrongParameters.verifier.verify(sig) rescue {}
|
14
14
|
else
|
data/test/auto_permit_test.rb
CHANGED
@@ -50,7 +50,7 @@ class AutoPermitTest < ActionController::TestCase
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_auto_permit
|
53
|
-
post :auto_permit, **process_args(user: user_params
|
53
|
+
post :auto_permit, **process_args(user: user_params, message_key => signature)
|
54
54
|
assert_response :ok
|
55
55
|
j = ActiveSupport::JSON.decode(response.body)
|
56
56
|
|
@@ -61,7 +61,7 @@ class AutoPermitTest < ActionController::TestCase
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_auto_permit_incorrect_signature
|
64
|
-
post :auto_permit, **process_args(user: user_params
|
64
|
+
post :auto_permit, **process_args(user: user_params, message_key => 'abc123')
|
65
65
|
assert_response :ok
|
66
66
|
j = ActiveSupport::JSON.decode(response.body)
|
67
67
|
|