controller-testing-kwargs 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/controller/testing/kwargs.rb +22 -16
- data/lib/controller/testing/kwargs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f1e9fa13a7f2d234aa3450dc9a87af826b91d62
|
4
|
+
data.tar.gz: 454e3ca38063041226b0162f16525ffacbd3b9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82c241dec360d3b6d2f2b2c7c8065311c234feb9f7c28ebd61225b927b602489f87c154db98c5f97ffd7b8c29ad4e627516c6a9b6d4dc2c3fa0c382f71e1f1af
|
7
|
+
data.tar.gz: b7fffdc81950c4251136e976c83e646d1ecdae19ea487b5ac4c6468f43c8b79c66350710e49afb2874ce3f3e44991e2a6964a196daa21adc84de4be38c1f9480
|
@@ -7,28 +7,40 @@ module Controller
|
|
7
7
|
ERROR_MESSAGE = 'Please use Rails 5 syntax. See: https://github.com/appfolio/controller-testing-kwargs'
|
8
8
|
|
9
9
|
class <<self
|
10
|
-
@
|
10
|
+
@action = :deprecation_warning
|
11
11
|
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :action
|
13
13
|
|
14
14
|
def deprecate
|
15
|
-
@
|
15
|
+
@action = :deprecation_warning
|
16
16
|
end
|
17
17
|
|
18
18
|
def deprecated?
|
19
|
-
@
|
19
|
+
@action == :deprecation_warning
|
20
20
|
end
|
21
21
|
|
22
22
|
def ignore
|
23
|
-
@
|
23
|
+
@action = nil
|
24
24
|
end
|
25
25
|
|
26
26
|
def raise_exception
|
27
|
-
@
|
27
|
+
@action = :raise_exceptioon
|
28
28
|
end
|
29
29
|
|
30
30
|
def raise_exception?
|
31
|
-
@
|
31
|
+
@action == :raise_exceptioon
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def with_ignore
|
37
|
+
previous_action = @action
|
38
|
+
@action = nil
|
39
|
+
begin
|
40
|
+
yield
|
41
|
+
ensure
|
42
|
+
@action = previous_action
|
43
|
+
end
|
32
44
|
end
|
33
45
|
end
|
34
46
|
|
@@ -60,15 +72,9 @@ module Controller
|
|
60
72
|
raise Exception, ERROR_MESSAGE if Controller::Testing::Kwargs.raise_exception? && old_method
|
61
73
|
ActiveSupport::Deprecation.warn(ERROR_MESSAGE) if Controller::Testing::Kwargs.deprecated? && old_method
|
62
74
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
begin
|
67
|
-
return xhr(method, action, request_params, request_headers)
|
68
|
-
ensure
|
69
|
-
Controller::Testing::Kwargs.instance_variable_set(:@on_old, previous_value)
|
70
|
-
end
|
71
|
-
end
|
75
|
+
Controller::Testing::Kwargs.send(:with_ignore) do
|
76
|
+
return xhr(method, action, request_params, request_headers)
|
77
|
+
end if xhr
|
72
78
|
super(action, request_params, request_headers)
|
73
79
|
end
|
74
80
|
end
|