minilab 1.0.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/.document +2 -0
  2. data/CHANGES +2 -0
  3. data/LICENSE +19 -0
  4. data/README +107 -0
  5. data/Rakefile +145 -0
  6. data/config/environment.rb +15 -0
  7. data/config/objects.yml +22 -0
  8. data/lib/analog_io.rb +30 -0
  9. data/lib/digital_auxport_io.rb +49 -0
  10. data/lib/digital_configuration.rb +66 -0
  11. data/lib/digital_port_io.rb +68 -0
  12. data/lib/extension/extconf.rb +4 -0
  13. data/lib/extension/minilab_hardware.c +235 -0
  14. data/lib/extension/minilab_hardware.so +0 -0
  15. data/lib/library_translator.rb +48 -0
  16. data/lib/minilab.rb +149 -0
  17. data/lib/minilab_context.rb +39 -0
  18. data/lib/result_verifier.rb +14 -0
  19. data/test/integration/analog_input_output_test.rb +43 -0
  20. data/test/integration/connect_to_hardware_test.rb +13 -0
  21. data/test/integration/digital_input_output_test.rb +114 -0
  22. data/test/integration/integration_test.rb +53 -0
  23. data/test/integration/require_minilab_test.rb +9 -0
  24. data/test/system/analog_input.test +3 -0
  25. data/test/system/analog_output.test +37 -0
  26. data/test/system/digital_port_input.test +5 -0
  27. data/test/system/digital_port_output.test +39 -0
  28. data/test/system/digital_port_read_byte.test +26 -0
  29. data/test/system/digital_screw_terminals_input.test +2 -0
  30. data/test/system/digital_screw_terminals_output.test +11 -0
  31. data/test/system/minilab_driver.rb +85 -0
  32. data/test/test_helper.rb +11 -0
  33. data/test/unit/analog_io_test.rb +87 -0
  34. data/test/unit/digital_auxport_io_test.rb +114 -0
  35. data/test/unit/digital_configuration_test.rb +136 -0
  36. data/test/unit/digital_port_io_test.rb +117 -0
  37. data/test/unit/library_translator_test.rb +100 -0
  38. data/test/unit/minilab_context_test.rb +82 -0
  39. data/test/unit/minilab_hardware_test.rb +83 -0
  40. data/test/unit/minilab_test.rb +131 -0
  41. data/test/unit/result_verifier_test.rb +33 -0
  42. data/vendor/behaviors/lib/behaviors.rb +50 -0
  43. data/vendor/behaviors/tasks/behaviors_tasks.rake +140 -0
  44. data/vendor/behaviors/test/behaviors_tasks_test.rb +71 -0
  45. data/vendor/behaviors/test/behaviors_test.rb +50 -0
  46. data/vendor/behaviors/test/tasks_test/Rakefile +16 -0
  47. data/vendor/behaviors/test/tasks_test/doc/behaviors.html +55 -0
  48. data/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
  49. data/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
  50. data/vendor/constructor/Rakefile +44 -0
  51. data/vendor/constructor/config/environment.rb +12 -0
  52. data/vendor/constructor/lib/constructor.rb +132 -0
  53. data/vendor/constructor/test/constructor_test.rb +366 -0
  54. data/vendor/constructor/test/helper.rb +3 -0
  55. data/vendor/diy/README +26 -0
  56. data/vendor/diy/Rakefile +18 -0
  57. data/vendor/diy/lib/constructor.rb +114 -0
  58. data/vendor/diy/lib/diy.rb +329 -0
  59. data/vendor/diy/proto/context.rb +117 -0
  60. data/vendor/diy/proto/context.yml +20 -0
  61. data/vendor/diy/test/diy_test.rb +370 -0
  62. data/vendor/diy/test/files/broken_construction.yml +7 -0
  63. data/vendor/diy/test/files/cat/cat.rb +4 -0
  64. data/vendor/diy/test/files/cat/extra_conflict.yml +5 -0
  65. data/vendor/diy/test/files/cat/heritage.rb +2 -0
  66. data/vendor/diy/test/files/cat/needs_input.yml +3 -0
  67. data/vendor/diy/test/files/cat/the_cat_lineage.rb +1 -0
  68. data/vendor/diy/test/files/dog/dog_model.rb +4 -0
  69. data/vendor/diy/test/files/dog/dog_presenter.rb +4 -0
  70. data/vendor/diy/test/files/dog/dog_view.rb +2 -0
  71. data/vendor/diy/test/files/dog/file_resolver.rb +2 -0
  72. data/vendor/diy/test/files/dog/other_thing.rb +2 -0
  73. data/vendor/diy/test/files/dog/simple.yml +11 -0
  74. data/vendor/diy/test/files/donkey/foo.rb +8 -0
  75. data/vendor/diy/test/files/donkey/foo/bar/qux.rb +7 -0
  76. data/vendor/diy/test/files/fud/objects.yml +13 -0
  77. data/vendor/diy/test/files/fud/toy.rb +15 -0
  78. data/vendor/diy/test/files/gnu/objects.yml +14 -0
  79. data/vendor/diy/test/files/gnu/thinger.rb +8 -0
  80. data/vendor/diy/test/files/goat/base.rb +8 -0
  81. data/vendor/diy/test/files/goat/can.rb +6 -0
  82. data/vendor/diy/test/files/goat/goat.rb +6 -0
  83. data/vendor/diy/test/files/goat/objects.yml +12 -0
  84. data/vendor/diy/test/files/goat/paper.rb +6 -0
  85. data/vendor/diy/test/files/goat/plane.rb +8 -0
  86. data/vendor/diy/test/files/goat/shirt.rb +6 -0
  87. data/vendor/diy/test/files/goat/wings.rb +8 -0
  88. data/vendor/diy/test/files/horse/holder_thing.rb +4 -0
  89. data/vendor/diy/test/files/horse/objects.yml +7 -0
  90. data/vendor/diy/test/files/yak/core_model.rb +4 -0
  91. data/vendor/diy/test/files/yak/core_presenter.rb +4 -0
  92. data/vendor/diy/test/files/yak/core_view.rb +1 -0
  93. data/vendor/diy/test/files/yak/data_source.rb +1 -0
  94. data/vendor/diy/test/files/yak/fringe_model.rb +4 -0
  95. data/vendor/diy/test/files/yak/fringe_presenter.rb +4 -0
  96. data/vendor/diy/test/files/yak/fringe_view.rb +1 -0
  97. data/vendor/diy/test/files/yak/my_objects.yml +21 -0
  98. data/vendor/diy/test/test_helper.rb +40 -0
  99. data/vendor/hardmock/CHANGES +8 -0
  100. data/vendor/hardmock/LICENSE +7 -0
  101. data/vendor/hardmock/README +48 -0
  102. data/vendor/hardmock/Rakefile +100 -0
  103. data/vendor/hardmock/TODO +7 -0
  104. data/vendor/hardmock/config/environment.rb +12 -0
  105. data/vendor/hardmock/homepage/demo.rb +21 -0
  106. data/vendor/hardmock/homepage/hardmock_sample.png +0 -0
  107. data/vendor/hardmock/homepage/index.html +65 -0
  108. data/vendor/hardmock/init.rb +3 -0
  109. data/vendor/hardmock/lib/hardmock.rb +634 -0
  110. data/vendor/hardmock/lib/method_cleanout.rb +14 -0
  111. data/vendor/hardmock/rcov.rake +18 -0
  112. data/vendor/hardmock/test/functional/assert_error_test.rb +52 -0
  113. data/vendor/hardmock/test/functional/auto_verify_test.rb +192 -0
  114. data/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -0
  115. data/vendor/hardmock/test/functional/hardmock_test.rb +380 -0
  116. data/vendor/hardmock/test/test_helper.rb +23 -0
  117. data/vendor/hardmock/test/unit/expectation_builder_test.rb +18 -0
  118. data/vendor/hardmock/test/unit/expector_test.rb +56 -0
  119. data/vendor/hardmock/test/unit/method_cleanout_test.rb +35 -0
  120. data/vendor/hardmock/test/unit/mock_control_test.rb +172 -0
  121. data/vendor/hardmock/test/unit/mock_test.rb +273 -0
  122. data/vendor/hardmock/test/unit/simple_expectation_test.rb +345 -0
  123. data/vendor/hardmock/test/unit/trapper_test.rb +60 -0
  124. data/vendor/hardmock/test/unit/verify_error_test.rb +34 -0
  125. data/vendor/systir/systir.rb +403 -0
  126. data/vendor/systir/test/unit/ui/xml/testrunner.rb +192 -0
  127. data/vendor/systir/test/unit/ui/xml/xmltestrunner.xslt +109 -0
  128. metadata +235 -0
@@ -0,0 +1,370 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+ require 'diy'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ class DIYTest < Test::Unit::TestCase
7
+
8
+ def setup
9
+ # Add load paths:
10
+ %w|gnu dog cat yak donkey goat horse fud|.each do |p|
11
+ libdir = path_to_test_file(p)
12
+ $: << libdir unless $:.member?(libdir)
13
+ end
14
+ end
15
+
16
+ #
17
+ # HELPERS
18
+ #
19
+ def path_to_test_file(fname)
20
+ path_to("/files/#{fname}")
21
+ end
22
+
23
+ def load_context(file_name)
24
+ hash = YAML.load(File.read(path_to_test_file(file_name)))
25
+ load_hash(hash)
26
+ end
27
+
28
+ def load_hash(hash)
29
+ @diy = DIY::Context.new(hash)
30
+ end
31
+
32
+ def check_dog_objects(context)
33
+ assert_not_nil context, "nil context"
34
+ names = %w|dog_presenter dog_model dog_view file_resolver|
35
+ names.each do |n|
36
+ assert context.contains_object(n), "Context had no object '#{n}'"
37
+ end
38
+ end
39
+
40
+ #
41
+ # TESTS
42
+ #
43
+
44
+ def test_essential_use_case
45
+ load_context "dog/simple.yml"
46
+
47
+ # Check object defs
48
+ check_dog_objects @diy
49
+
50
+ # Tweak the load-path
51
+ $: << path_to_test_file("dog")
52
+
53
+ # Get the objects, use reference comparison to check composition
54
+ presenter = @diy.get_object('dog_presenter')
55
+ assert_not_nil presenter, 'nil dog_presenter'
56
+
57
+ model = @diy.get_object('dog_model')
58
+ assert_not_nil model, 'nil dog_model'
59
+ assert_same presenter.model, model, "Different model came from context than found in presenter"
60
+
61
+ view = @diy.get_object('dog_view')
62
+ assert_not_nil view, 'nil dog_view'
63
+ assert_same presenter.view, view, "Different view came from context than found in presenter"
64
+
65
+ resolver = @diy.get_object('file_resolver')
66
+ assert_not_nil resolver, 'nil file_resolver'
67
+ assert_same model.file_resolver, resolver, "File resolver in model is different than one in context"
68
+
69
+ # Check repeat access:
70
+ assert_same model, @diy.get_object('dog_model'), "Second access of model yielded different result"
71
+ assert_same view, @diy.get_object('dog_view'), "Second access of view yielded different result"
72
+ assert_same presenter, @diy.get_object('dog_presenter'), "Second access of presenter got difrnt result"
73
+ end
74
+
75
+ def test_classname_inside_a_module
76
+ load_hash 'thinger' => {'class' => "DiyTesting::Bar::Foo", 'lib' => 'foo'}
77
+ @diy.build_everything
78
+ assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)"
79
+ end
80
+
81
+ def test_classname_inside_a_module_loads_from_directories_named_after_the_underscored_module_names
82
+ load_hash 'thinger' => {'class' => "Foo::Bar::Qux"}
83
+ # expect it to be loaded from: foo/bar/qux.rb
84
+ @diy.build_everything
85
+ assert_not_nil @diy['thinger'], "Should have got my thinger (which is hiding in a couple modules)"
86
+ end
87
+
88
+ def test_classname_inside_a_module_derives_the_namespaced_classname_from_the_underscored_object_def_key
89
+ load_hash 'foo/bar/qux' => nil
90
+ @diy.build_everything
91
+ assert_not_nil @diy['foo/bar/qux'], "Should have got my qux (which is hiding in a couple modules)"
92
+ end
93
+
94
+ def test_keys
95
+ load_context "dog/simple.yml"
96
+ assert_equal %w|dog_model dog_presenter dog_view file_resolver other_thing|, @diy.keys.sort
97
+ end
98
+
99
+ def test_constructor_no_hash
100
+ assert_raise RuntimeError do DIY::Context.new(nil) end
101
+ end
102
+
103
+ def test_constructor_bad_extra_inputs
104
+ err = assert_raise RuntimeError do
105
+ DIY::Context.new({}, Object.new)
106
+ end
107
+ assert_match(/extra inputs/i, err.message)
108
+ end
109
+
110
+ def test_from_yaml
111
+ text = File.read(path_to_test_file("dog/simple.yml"))
112
+ diy = DIY::Context.from_yaml(text)
113
+ check_dog_objects diy
114
+ end
115
+
116
+ def test_from_yaml_extra_inputs
117
+ extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' }
118
+ diy = DIY::Context.from_yaml(File.read(path_to_test_file('cat/needs_input.yml')), extra)
119
+ cat = diy['cat']
120
+ assert_equal 'siamese', cat.heritage
121
+ assert_equal 'horse', cat.food
122
+ end
123
+
124
+ def test_from_file
125
+ diy = DIY::Context.from_file(path_to_test_file("dog/simple.yml"))
126
+ check_dog_objects diy
127
+ end
128
+
129
+ def test_from_file_bad
130
+ assert_raise RuntimeError do
131
+ DIY::Context.from_file(nil)
132
+ end
133
+ assert_raise Errno::ENOENT do
134
+ DIY::Context.from_file("bad file name")
135
+ end
136
+ end
137
+
138
+ def test_from_file_extra_inputs
139
+ extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' }
140
+ diy = DIY::Context.from_file(path_to_test_file('cat/needs_input.yml'), extra)
141
+ cat = diy['cat']
142
+ assert_equal 'siamese', cat.heritage
143
+ assert_equal 'horse', cat.food
144
+ end
145
+
146
+ def test_contains_object
147
+ load_context "dog/simple.yml"
148
+ assert @diy.contains_object('dog_presenter'), "Should be true for dog_presenter"
149
+ assert !@diy.contains_object('woops'), "Should return false for 'woops'"
150
+ err = assert_raise ArgumentError do
151
+ @diy.contains_object(nil)
152
+ end
153
+ end
154
+
155
+ def test_contains_object_extra_inputs
156
+ extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' }
157
+ main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml')))
158
+ diy = DIY::Context.new(main, extra)
159
+
160
+ assert diy.contains_object('cat')
161
+ assert diy.contains_object('the_cat_lineage')
162
+ assert diy.contains_object('some_meat')
163
+ end
164
+
165
+ def test_get_object
166
+ load_context "dog/simple.yml"
167
+ assert_not_nil @diy.get_object('file_resolver'), "nil resolver?"
168
+ assert_raise ArgumentError do
169
+ @diy.get_object(nil)
170
+ end
171
+ assert_raise DIY::ConstructionError do
172
+ @diy.get_object("no such object")
173
+ end
174
+ end
175
+
176
+ def test_hash_style_access
177
+ load_context "dog/simple.yml"
178
+ assert_not_nil @diy['file_resolver'], "nil resolver?"
179
+ assert_raise ArgumentError do
180
+ @diy[nil]
181
+ end
182
+ assert_raise DIY::ConstructionError do
183
+ @diy["no such object"]
184
+ end
185
+ end
186
+
187
+ def test_get_object_construction_error
188
+ load_context "broken_construction.yml"
189
+ err = assert_raise DIY::ConstructionError do
190
+ @diy.get_object 'dog_presenter'
191
+ end
192
+ assert_match(/dog_presenter/, err.message)
193
+ end
194
+
195
+ def test_context_with_extra_inputs
196
+ extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' }
197
+ main = YAML.load(File.read(path_to_test_file('cat/needs_input.yml')))
198
+ diy = DIY::Context.new(main, extra)
199
+ cat = diy['cat']
200
+ assert_equal 'siamese', cat.heritage
201
+ assert_equal 'horse', cat.food
202
+ end
203
+
204
+ def test_conflicting_extra_inputs
205
+ extra = { 'the_cat_lineage' => 'siamese', :some_meat => 'horse' }
206
+ main = YAML.load(File.read(path_to_test_file('cat/extra_conflict.yml')))
207
+
208
+ DIY::Context.new(main,extra)
209
+ flunk "Should have raised err"
210
+ rescue Exception => err
211
+ assert_match(/conflict/i, err.message)
212
+ end
213
+
214
+ def test_sub_context
215
+ load_context 'yak/my_objects.yml'
216
+
217
+ core_model = @diy['core_model']
218
+ assert_not_nil core_model, "no core model in main context?"
219
+
220
+ fmodel1 = nil
221
+ fview1 = nil
222
+ @diy.within('fringe_context') do |fc|
223
+ assert_not_nil fc["fringe_presenter"], "no fringe presenter"
224
+ fmodel1 = fc["fringe_model"]
225
+ fmodel1a = fc["fringe_model"]
226
+ assert_same fmodel1, fmodel1a, "Second fring model in fringe_context came out different"
227
+ assert_not_nil fmodel1, "no fringe_model"
228
+ fview1 = fc["fringe_view"]
229
+ assert_not_nil fview1, "no fringe_view"
230
+ assert_same core_model, fmodel1.connected
231
+ end
232
+
233
+ fmodel2 = nil
234
+ fview2 = nil
235
+ @diy.within('fringe_context') do |fc|
236
+ assert_not_nil fc["fringe_presenter"], "2: no fringe presenter"
237
+ fmodel2 = fc["fringe_model"]
238
+ fmodel2a = fc["fringe_model"]
239
+ assert_same fmodel2, fmodel2a, "Second fringe model in fringe_context came out different"
240
+ assert_not_nil fmodel2, "2: no fringe_model"
241
+ fview2 = fc["fringe_view"]
242
+ assert_not_nil fview2, "2: no fringe_view"
243
+ assert_same core_model, fmodel2.connected
244
+
245
+ assert fmodel1.object_id != fmodel2.object_id, "fringe models 1 and 2 are same!"
246
+ assert fview1.object_id != fview2.object_id, "fringe views 1 and 2 are same!"
247
+ end
248
+ end
249
+
250
+ def test_build_everything
251
+ # Singletons in the goat context will generate test output in their constructors.
252
+ # We just gotta tell em where:
253
+ ofile = path_to_test_file('goat/output.tmp')
254
+ $goat_test_output_file = ofile
255
+
256
+ # Reusable setup for this test
257
+ prep_output = proc do
258
+ remove ofile if File.exist?(ofile)
259
+ end
260
+
261
+ # Reusable assertion set and cleanup
262
+ examine_output = proc do
263
+ # Examine output file for expected construction
264
+ assert File.exist?(ofile), "no goat output created"
265
+ lines = File.readlines(ofile).map { |x| x.strip }
266
+ %w|can paper shirt goat|.each do |object|
267
+ assert lines.member?("#{object} built"), "Didn't see constructor output for #{object}"
268
+ end
269
+ assert_equal 4, lines.size, "wrong number of entries in output file"
270
+
271
+ # Make sure the subcontext was not built
272
+ assert !lines.member?("plane built"), "plane should not have been built -- it's in the subcontext"
273
+ assert !lines.member?("wings built"), "wings should not have been built -- it's in the subcontext"
274
+
275
+ # Check the objects in the context
276
+ %w|can paper shirt goat|.each do |object|
277
+ assert_same @diy[object], @diy[object], "Multiple accesses on #{object} yielded different refs"
278
+ end
279
+
280
+ # Try the subcontext
281
+ @diy.within('the_sub_context') do |tsc|
282
+ %w|plane wings|.each do |object|
283
+ assert_same tsc[object], tsc[object], "Multiple accesses on #{object} (in subcontext) yielded different refs"
284
+ end
285
+ end
286
+ # cleanup
287
+ remove ofile if File.exist?(ofile)
288
+ end
289
+
290
+ # Test all three methods
291
+ [:build_everything, :build_all, :preinstantiate_singletons].each do |method_name|
292
+ prep_output.call
293
+ load_context 'goat/objects.yml'
294
+ # go
295
+ @diy.send method_name
296
+ examine_output.call
297
+ end
298
+ ensure
299
+ # cleanup
300
+ remove ofile if File.exist?(ofile)
301
+ end
302
+
303
+ # See that the current object factory context can be referenced within the yaml
304
+ def test_this_context
305
+ load_context 'horse/objects.yml'
306
+
307
+ assert_same @diy, @diy['this_context'], "basic self-reference failed"
308
+ assert_same @diy, @diy['holder_thing'].thing_held, "composition self-reference failed"
309
+ end
310
+
311
+ def test_this_context_works_for_subcontexts
312
+ load_context 'horse/objects.yml'
313
+
314
+ @diy.within('repeater') do |ctx|
315
+ assert_same ctx, ctx['this_context'], "self-ref inside a subcontext doesn't work"
316
+ end
317
+ end
318
+
319
+ def test_multiple_classes_in_one_file
320
+ load_context 'fud/objects.yml'
321
+
322
+ toy = @diy['toy']
323
+ widget = @diy['widget']
324
+ thing = @diy['thing_ama_jack']
325
+ trinket = @diy['trinket']
326
+
327
+ assert_same widget, toy.widget, "wrong widget in toy"
328
+ assert_same trinket, toy.trinket, "wrong trinket in toy"
329
+ assert_same thing, trinket.thing_ama_jack, "wrong thing_ama_jack in trinket"
330
+ end
331
+
332
+ def test_objects_can_be_set_in_a_context_and_diy_will_not_attempt_to_build_it_as_a_dependency
333
+ load_context 'gnu/objects.yml'
334
+
335
+ injected = 'boom'
336
+ @diy[:injected] = injected
337
+ thinger = @diy[:thinger]
338
+ assert_not_nil thinger
339
+ assert_same injected, thinger.injected
340
+ assert_same injected, @diy[:injected]
341
+
342
+ inner_injected = 'slam'
343
+ @diy.within :inny do |sub|
344
+ sub.set_object :inner_injected, inner_injected
345
+ inner_thinger = sub[:inner_thinger]
346
+ assert_not_nil inner_thinger
347
+ assert_same inner_injected, inner_thinger.injected
348
+ assert_same inner_injected, sub[:inner_injected]
349
+ end
350
+ end
351
+
352
+ def test_should_not_allow_setting_of_an_object_which_has_already_been_loaded
353
+ load_context 'gnu/objects.yml'
354
+
355
+ injected = 'boom'
356
+ @diy[:injected] = injected
357
+ err = assert_raise RuntimeError do
358
+ @diy[:injected] = injected
359
+ end
360
+ assert_match /object 'injected' already exists/i, err.message
361
+ assert_same injected, @diy[:injected]
362
+
363
+ thinger = @diy[:thinger]
364
+ err = assert_raise RuntimeError do
365
+ @diy[:thinger] = 'sdf'
366
+ end
367
+ assert_match /object 'thinger' already exists/i, err.message
368
+ assert_same thinger, @diy[:thinger]
369
+ end
370
+ end
@@ -0,0 +1,7 @@
1
+
2
+ dog_presenter:
3
+ model: dog_model
4
+ view: dog_view
5
+
6
+ dog_model:
7
+ # VIEW IS MISSING, PRESENTER SHOULD CRASH
@@ -0,0 +1,4 @@
1
+ require 'constructor'
2
+ class Cat
3
+ constructor :heritage, :food, :strict => true, :accessors => true
4
+ end
@@ -0,0 +1,5 @@
1
+ the_cat_lineage:
2
+
3
+ cat:
4
+ heritage: the_cat_lineage
5
+ food: some_meat
@@ -0,0 +1,2 @@
1
+ class Heritage
2
+ end
@@ -0,0 +1,3 @@
1
+ cat:
2
+ heritage: the_cat_lineage
3
+ food: some_meat
@@ -0,0 +1 @@
1
+ class TheCatLineage; end
@@ -0,0 +1,4 @@
1
+ require 'constructor'
2
+ class DogModel
3
+ constructor :file_resolver, :other_thing, :strict => true, :accessors => true
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'constructor'
2
+ class DogPresenter
3
+ constructor :model, :view, :strict => true, :accessors => true
4
+ end
@@ -0,0 +1,2 @@
1
+ class DogView
2
+ end
@@ -0,0 +1,2 @@
1
+ class FileResolver
2
+ end
@@ -0,0 +1,2 @@
1
+ class OtherThing
2
+ end
@@ -0,0 +1,11 @@
1
+ dog_presenter:
2
+ model: dog_model
3
+ view: dog_view
4
+
5
+ file_resolver:
6
+ other_thing:
7
+
8
+ dog_model:
9
+ compose: file_resolver, other_thing
10
+
11
+ dog_view:
@@ -0,0 +1,8 @@
1
+
2
+ module DiyTesting
3
+ module Bar
4
+ class Foo
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,7 @@
1
+
2
+ module Foo
3
+ module Bar
4
+ class Qux
5
+ end
6
+ end
7
+ end