husky 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/husky/pass_along.rb +36 -0
- data/lib/husky/responder.rb +4 -12
- data/lib/husky/version.rb +1 -1
- data/test/dummy/app/controllers/home_controller.rb +1 -2
- data/test/dummy/log/development.log +42 -0
- data/test/dummy/log/test.log +240 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/integration/controller_to_responder_test.rb +10 -0
- data/test/unit/pass_along_test.rb +33 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291839d8360ad855bb77a59848b590ad42a22db3
|
4
|
+
data.tar.gz: 01c67b0b89979eb6fe1dc386a13ef0bb4c5a25d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3e6d7cc798d94b33c761d7348c0a4a01236998186f98fe1b3aa00bb46371221b9ba11df89622f619ac27e6a15a0346f5e2fe9927ac8e37e323f686639968818
|
7
|
+
data.tar.gz: 332bb75f4b27e3ea0738b7ff1694a9b7edf2b9370e140048d5af278b64c3157f59f1367382362575e5a95a92b96d38a532cba52c6a55f4845c7e0a970d846182
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class PassAlong
|
2
|
+
|
3
|
+
def self.all_variables(sender, receiver)
|
4
|
+
sender.class.instance_methods(false).each do |method|
|
5
|
+
new(sender, receiver, method).run
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :sender, :receiver, :method
|
10
|
+
|
11
|
+
def initialize(sender, receiver, method)
|
12
|
+
@sender = sender
|
13
|
+
@receiver = receiver
|
14
|
+
@method = method
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
sender.class.after method do |*, obj|
|
19
|
+
variables = get_variables_from(sender)
|
20
|
+
variables.each do |var|
|
21
|
+
receiver.instance_variable_set(var, sender.instance_variable_get(var))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def get_variables_from(sender)
|
29
|
+
variables = sender.instance_variables.dup
|
30
|
+
variables.delete(:@context)
|
31
|
+
variables.delete(:@delegate_sd_obj)
|
32
|
+
variables
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
data/lib/husky/responder.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'delegate'
|
2
2
|
require 'after_do'
|
3
|
+
require 'husky/pass_along'
|
3
4
|
|
4
5
|
module Husky
|
5
6
|
|
@@ -42,15 +43,6 @@ module Husky
|
|
42
43
|
|
43
44
|
end
|
44
45
|
|
45
|
-
Husky::Responder.after :initialize do |*,
|
46
|
-
|
47
|
-
|
48
|
-
pass_alongs = obj.instance_variables.dup
|
49
|
-
pass_alongs.delete(:@context)
|
50
|
-
pass_alongs.delete(:@delegate_sd_obj)
|
51
|
-
pass_alongs.each do |var|
|
52
|
-
obj.context.instance_variable_set(var, obj.instance_variable_get(var))
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
46
|
+
Husky::Responder.after :initialize do |*, responder|
|
47
|
+
PassAlong.all_variables(responder, responder.context)
|
48
|
+
end
|
data/lib/husky/version.rb
CHANGED
@@ -952,3 +952,45 @@ Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1
|
|
952
952
|
|
953
953
|
|
954
954
|
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-02-14 13:19:24 -0500
|
955
|
+
|
956
|
+
|
957
|
+
Started GET "/" for ::1 at 2016-02-14 13:41:30 -0500
|
958
|
+
Processing by HomeController#index as HTML
|
959
|
+
Rendered home/index.html.erb within layouts/application (2.0ms)
|
960
|
+
Completed 200 OK in 251ms (Views: 248.2ms | ActiveRecord: 0.0ms)
|
961
|
+
|
962
|
+
|
963
|
+
Started GET "/" for ::1 at 2016-02-14 13:42:33 -0500
|
964
|
+
Processing by HomeController#index as HTML
|
965
|
+
Rendered home/index.html.erb within layouts/application (2.0ms)
|
966
|
+
Completed 200 OK in 267ms (Views: 263.6ms | ActiveRecord: 0.0ms)
|
967
|
+
|
968
|
+
|
969
|
+
Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-02-14 13:42:34 -0500
|
970
|
+
|
971
|
+
|
972
|
+
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-02-14 13:42:34 -0500
|
973
|
+
|
974
|
+
|
975
|
+
Started GET "/" for ::1 at 2016-02-14 13:44:40 -0500
|
976
|
+
Processing by HomeController#index as HTML
|
977
|
+
Rendered home/index.html.erb within layouts/application (1.9ms)
|
978
|
+
Completed 200 OK in 255ms (Views: 251.9ms | ActiveRecord: 0.0ms)
|
979
|
+
|
980
|
+
|
981
|
+
Started GET "/" for ::1 at 2016-02-14 13:46:46 -0500
|
982
|
+
Processing by HomeController#index as HTML
|
983
|
+
Rendered home/index.html.erb within layouts/application (2.8ms)
|
984
|
+
Completed 200 OK in 326ms (Views: 321.5ms | ActiveRecord: 0.0ms)
|
985
|
+
|
986
|
+
|
987
|
+
Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-02-14 13:46:46 -0500
|
988
|
+
|
989
|
+
|
990
|
+
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-02-14 13:46:46 -0500
|
991
|
+
|
992
|
+
|
993
|
+
Started GET "/" for ::1 at 2016-02-14 13:47:35 -0500
|
994
|
+
Processing by HomeController#index as HTML
|
995
|
+
Rendered home/index.html.erb within layouts/application (2.2ms)
|
996
|
+
Completed 200 OK in 253ms (Views: 250.2ms | ActiveRecord: 0.0ms)
|
data/test/dummy/log/test.log
CHANGED
@@ -8,3 +8,243 @@ HuskyTest: test_truth
|
|
8
8
|
HuskyTest: test_truth
|
9
9
|
---------------------
|
10
10
|
[1m[35m (0.1ms)[0m rollback transaction
|
11
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
12
|
+
---------------------
|
13
|
+
HuskyTest: test_truth
|
14
|
+
---------------------
|
15
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
16
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
17
|
+
-------------------------------------------------------------------------------------------
|
18
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder
|
19
|
+
-------------------------------------------------------------------------------------------
|
20
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:33:19 -0500
|
21
|
+
Processing by HomeController#index as HTML
|
22
|
+
Parameters: {"car"=>"Mustang"}
|
23
|
+
Rendered home/index.html.erb within layouts/application (1.9ms)
|
24
|
+
Completed 200 OK in 203ms (Views: 199.5ms | ActiveRecord: 0.0ms)
|
25
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
26
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
27
|
+
---------------------
|
28
|
+
HuskyTest: test_truth
|
29
|
+
---------------------
|
30
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
31
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
32
|
+
-------------------------------------------------------------------------------------------
|
33
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder
|
34
|
+
-------------------------------------------------------------------------------------------
|
35
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:35:00 -0500
|
36
|
+
Processing by HomeController#index as HTML
|
37
|
+
Parameters: {"car"=>"Mustang"}
|
38
|
+
Rendered home/index.html.erb within layouts/application (2.5ms)
|
39
|
+
Completed 200 OK in 196ms (Views: 193.3ms | ActiveRecord: 0.0ms)
|
40
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
41
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
42
|
+
-------------------------------------------------------------------------------------------
|
43
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder
|
44
|
+
-------------------------------------------------------------------------------------------
|
45
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:35:14 -0500
|
46
|
+
Processing by HomeController#index as HTML
|
47
|
+
Parameters: {"car"=>"Mustang"}
|
48
|
+
Rendered home/index.html.erb within layouts/application (1.6ms)
|
49
|
+
Completed 200 OK in 194ms (Views: 192.0ms | ActiveRecord: 0.0ms)
|
50
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
51
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
52
|
+
---------------------
|
53
|
+
HuskyTest: test_truth
|
54
|
+
---------------------
|
55
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
56
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
57
|
+
-------------------------------------------------------------------------------------------
|
58
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder
|
59
|
+
-------------------------------------------------------------------------------------------
|
60
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:35:44 -0500
|
61
|
+
Processing by HomeController#index as HTML
|
62
|
+
Parameters: {"car"=>"Mustang"}
|
63
|
+
Rendered home/index.html.erb within layouts/application (1.8ms)
|
64
|
+
Completed 200 OK in 201ms (Views: 199.2ms | ActiveRecord: 0.0ms)
|
65
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
66
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
67
|
+
---------------------
|
68
|
+
HuskyTest: test_truth
|
69
|
+
---------------------
|
70
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
71
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
72
|
+
--------------------------------------------------------------------------------
|
73
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
74
|
+
--------------------------------------------------------------------------------
|
75
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
76
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
77
|
+
---------------------
|
78
|
+
HuskyTest: test_truth
|
79
|
+
---------------------
|
80
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
81
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
82
|
+
----------------------------------------------------------------------------------------------------------------
|
83
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
84
|
+
----------------------------------------------------------------------------------------------------------------
|
85
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:42:31 -0500
|
86
|
+
Processing by HomeController#index as HTML
|
87
|
+
Parameters: {"car"=>"Mustang"}
|
88
|
+
Rendered home/index.html.erb within layouts/application (1.8ms)
|
89
|
+
Completed 200 OK in 196ms (Views: 193.5ms | ActiveRecord: 0.0ms)
|
90
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
91
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
92
|
+
---------------------
|
93
|
+
HuskyTest: test_truth
|
94
|
+
---------------------
|
95
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
96
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
97
|
+
----------------------------------------------------------------------------------------------------------------
|
98
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
99
|
+
----------------------------------------------------------------------------------------------------------------
|
100
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:42:48 -0500
|
101
|
+
Processing by HomeController#index as HTML
|
102
|
+
Parameters: {"car"=>"Mustang"}
|
103
|
+
Rendered home/index.html.erb within layouts/application (1.3ms)
|
104
|
+
Completed 200 OK in 186ms (Views: 184.1ms | ActiveRecord: 0.0ms)
|
105
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
106
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
107
|
+
--------------------------------------------------------------------------------
|
108
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
109
|
+
--------------------------------------------------------------------------------
|
110
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
111
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
112
|
+
----------------------------------------------------------------------------------------------------------------
|
113
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
114
|
+
----------------------------------------------------------------------------------------------------------------
|
115
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:43:50 -0500
|
116
|
+
Processing by HomeController#index as HTML
|
117
|
+
Parameters: {"car"=>"Mustang"}
|
118
|
+
Rendered home/index.html.erb within layouts/application (1.8ms)
|
119
|
+
Completed 200 OK in 199ms (Views: 196.8ms | ActiveRecord: 0.0ms)
|
120
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
121
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
122
|
+
---------------------
|
123
|
+
HuskyTest: test_truth
|
124
|
+
---------------------
|
125
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
126
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
127
|
+
--------------------------------------------------------------------------------
|
128
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
129
|
+
--------------------------------------------------------------------------------
|
130
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
131
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
132
|
+
---------------------
|
133
|
+
HuskyTest: test_truth
|
134
|
+
---------------------
|
135
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
136
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
137
|
+
----------------------------------------------------------------------------------------------------------------
|
138
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
139
|
+
----------------------------------------------------------------------------------------------------------------
|
140
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:45:26 -0500
|
141
|
+
Processing by HomeController#index as HTML
|
142
|
+
Parameters: {"car"=>"Mustang"}
|
143
|
+
Rendered home/index.html.erb within layouts/application (1.5ms)
|
144
|
+
Completed 200 OK in 191ms (Views: 189.7ms | ActiveRecord: 0.0ms)
|
145
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
146
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
147
|
+
--------------------------------------------------------------------------------
|
148
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
149
|
+
--------------------------------------------------------------------------------
|
150
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
151
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
152
|
+
----------------------------------------------------------------------------------------------------------------
|
153
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
154
|
+
----------------------------------------------------------------------------------------------------------------
|
155
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:45:54 -0500
|
156
|
+
Processing by HomeController#index as HTML
|
157
|
+
Parameters: {"car"=>"Mustang"}
|
158
|
+
Rendered home/index.html.erb within layouts/application (1.7ms)
|
159
|
+
Completed 200 OK in 190ms (Views: 188.2ms | ActiveRecord: 0.0ms)
|
160
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
161
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
162
|
+
---------------------
|
163
|
+
HuskyTest: test_truth
|
164
|
+
---------------------
|
165
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
166
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
167
|
+
--------------------------------------------------------------------------------
|
168
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
169
|
+
--------------------------------------------------------------------------------
|
170
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
171
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
172
|
+
--------------------------------------------------------------------------------
|
173
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender
|
174
|
+
--------------------------------------------------------------------------------
|
175
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
176
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
177
|
+
----------------------------------------------------------------------------------------------------------------
|
178
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
179
|
+
----------------------------------------------------------------------------------------------------------------
|
180
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:46:50 -0500
|
181
|
+
Processing by HomeController#index as HTML
|
182
|
+
Parameters: {"car"=>"Mustang"}
|
183
|
+
Rendered home/index.html.erb within layouts/application (1.7ms)
|
184
|
+
Completed 200 OK in 188ms (Views: 186.5ms | ActiveRecord: 0.0ms)
|
185
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
186
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
187
|
+
---------------------
|
188
|
+
HuskyTest: test_truth
|
189
|
+
---------------------
|
190
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
191
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
192
|
+
----------------------------------------------------------------------------------------------------------------
|
193
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
194
|
+
----------------------------------------------------------------------------------------------------------------
|
195
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:46:56 -0500
|
196
|
+
Processing by HomeController#index as HTML
|
197
|
+
Parameters: {"car"=>"Mustang"}
|
198
|
+
Rendered home/index.html.erb within layouts/application (1.4ms)
|
199
|
+
Completed 200 OK in 184ms (Views: 182.5ms | ActiveRecord: 0.0ms)
|
200
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
201
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
202
|
+
---------------------
|
203
|
+
HuskyTest: test_truth
|
204
|
+
---------------------
|
205
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
206
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
207
|
+
---------------------------------------------------------------------------------------------------------
|
208
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender_after_a_method_is_called
|
209
|
+
---------------------------------------------------------------------------------------------------------
|
210
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
211
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
212
|
+
---------------------------------------------------------------------------------------------------------
|
213
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender_after_a_method_is_called
|
214
|
+
---------------------------------------------------------------------------------------------------------
|
215
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
216
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
217
|
+
---------------------
|
218
|
+
HuskyTest: test_truth
|
219
|
+
---------------------
|
220
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
221
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
222
|
+
----------------------------------------------------------------------------------------------------------------
|
223
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
224
|
+
----------------------------------------------------------------------------------------------------------------
|
225
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:48:08 -0500
|
226
|
+
Processing by HomeController#index as HTML
|
227
|
+
Parameters: {"car"=>"Mustang"}
|
228
|
+
Rendered home/index.html.erb within layouts/application (1.7ms)
|
229
|
+
Completed 200 OK in 193ms (Views: 189.6ms | ActiveRecord: 0.0ms)
|
230
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
231
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
232
|
+
---------------------
|
233
|
+
HuskyTest: test_truth
|
234
|
+
---------------------
|
235
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
236
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
237
|
+
----------------------------------------------------------------------------------------------------------------
|
238
|
+
ControllerToResponderTest: test_it_can_pass_a_variable_from_the_controller_to_the_responder_through_the_listener
|
239
|
+
----------------------------------------------------------------------------------------------------------------
|
240
|
+
Started GET "/?car=Mustang" for 127.0.0.1 at 2016-02-15 08:48:14 -0500
|
241
|
+
Processing by HomeController#index as HTML
|
242
|
+
Parameters: {"car"=>"Mustang"}
|
243
|
+
Rendered home/index.html.erb within layouts/application (2.4ms)
|
244
|
+
Completed 200 OK in 195ms (Views: 193.1ms | ActiveRecord: 0.0ms)
|
245
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
246
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
247
|
+
---------------------------------------------------------------------------------------------------------
|
248
|
+
PassAlongTest: test_the_receiver_receives_all_instance_variables_from_the_sender_after_a_method_is_called
|
249
|
+
---------------------------------------------------------------------------------------------------------
|
250
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
@@ -0,0 +1 @@
|
|
1
|
+
52283
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ControllerToResponderTest < ActionDispatch::IntegrationTest
|
4
|
+
|
5
|
+
test 'it can pass a variable from the controller to the responder through the listener' do
|
6
|
+
get root_path(car: "Mustang")
|
7
|
+
assert_includes response.body, "Mustang", "Should include the passed in value in the response."
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class PassAlongTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
# After a method is called on a Responder, we need to send all instance variables
|
6
|
+
# that were created back to the controller for the view
|
7
|
+
test 'the receiver receives all instance variables from the sender after a method is called' do
|
8
|
+
sam = Sam.new("Sam", "M", "Opportunist")
|
9
|
+
bob = Bob.new
|
10
|
+
PassAlong.all_variables(sam, bob)
|
11
|
+
sam.useless_method
|
12
|
+
assert_equal [:@gender, :@job_title, :@name], bob.instance_variables.sort
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
class Sam
|
17
|
+
extend AfterDo
|
18
|
+
|
19
|
+
def initialize(name, gender, job_title)
|
20
|
+
@name = name
|
21
|
+
@gender = gender
|
22
|
+
@job_title = job_title
|
23
|
+
end
|
24
|
+
|
25
|
+
def useless_method
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
class Bob
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: husky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Fiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/husky/broadcaster.rb
|
69
69
|
- lib/husky/ears.rb
|
70
70
|
- lib/husky/interactor.rb
|
71
|
+
- lib/husky/pass_along.rb
|
71
72
|
- lib/husky/responder.rb
|
72
73
|
- lib/husky/version.rb
|
73
74
|
- lib/tasks/husky_tasks.rake
|
@@ -135,8 +136,11 @@ files:
|
|
135
136
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
|
136
137
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/rCJuFBH8Fov8dpwePE7ii_GkEiWZmYCXPNwE7hXfDHk.cache
|
137
138
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/s_EnWD5m6LCrz5h5n5JvgDrju2NSa-v2JM93NSvIf2I.cache
|
139
|
+
- test/dummy/tmp/pids/server.pid
|
138
140
|
- test/husky_test.rb
|
141
|
+
- test/integration/controller_to_responder_test.rb
|
139
142
|
- test/test_helper.rb
|
143
|
+
- test/unit/pass_along_test.rb
|
140
144
|
homepage: http://www.huskyrb.com
|
141
145
|
licenses:
|
142
146
|
- MIT
|
@@ -226,5 +230,8 @@ test_files:
|
|
226
230
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache
|
227
231
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/rCJuFBH8Fov8dpwePE7ii_GkEiWZmYCXPNwE7hXfDHk.cache
|
228
232
|
- test/dummy/tmp/cache/assets/sprockets/v3.0/s_EnWD5m6LCrz5h5n5JvgDrju2NSa-v2JM93NSvIf2I.cache
|
233
|
+
- test/dummy/tmp/pids/server.pid
|
229
234
|
- test/husky_test.rb
|
235
|
+
- test/integration/controller_to_responder_test.rb
|
230
236
|
- test/test_helper.rb
|
237
|
+
- test/unit/pass_along_test.rb
|