hyper-mesh 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +7 -2
  4. data/README.md +112 -87
  5. data/Rakefile +6 -1
  6. data/docs/action_cable_quickstart.md +20 -16
  7. data/docs/activerecord_api.md +23 -17
  8. data/docs/authorization-policies.md +45 -35
  9. data/docs/client_side_scoping.md +5 -5
  10. data/docs/configuration_details.md +6 -46
  11. data/docs/pusher_faker_quickstart.md +7 -68
  12. data/docs/pusher_quickstart.md +7 -68
  13. data/docs/simple_poller_quickstart.md +6 -67
  14. data/docs/todo-example.md +2 -2
  15. data/docs/word_game.md +3 -1
  16. data/docs/words-example.md +2 -3
  17. data/examples/action-cable/Gemfile +2 -1
  18. data/examples/action-cable/Gemfile.lock +73 -54
  19. data/examples/action-cable/config/initializers/{hyper_mesh.rb → hyperloop.rb} +1 -1
  20. data/examples/action-cable/config/routes.rb +1 -1
  21. data/hyper-mesh.gemspec +10 -4
  22. data/lib/active_record_base.rb +3 -3
  23. data/{examples/action-cable-production-mode/log/.keep → lib/acts_as_string.rb} +0 -0
  24. data/lib/hyper-mesh.rb +11 -19
  25. data/lib/hyper_mesh/version.rb +3 -0
  26. data/lib/hypermesh/version.rb +1 -1
  27. data/lib/reactive_record/active_record/class_methods.rb +10 -3
  28. data/lib/reactive_record/active_record/instance_methods.rb +8 -0
  29. data/lib/reactive_record/active_record/public_columns_hash.rb +8 -2
  30. data/lib/reactive_record/active_record/reactive_record/collection.rb +0 -1
  31. data/lib/reactive_record/active_record/reactive_record/dummy_value.rb +2 -1
  32. data/lib/reactive_record/active_record/reactive_record/isomorphic_base.rb +55 -63
  33. data/lib/reactive_record/active_record/reactive_record/operations.rb +51 -0
  34. data/lib/reactive_record/active_record/reactive_record/reactive_set_relationship_helpers.rb +3 -3
  35. data/lib/reactive_record/active_record/reactive_record/while_loading.rb +93 -84
  36. data/lib/reactive_record/broadcast.rb +183 -0
  37. data/lib/reactive_record/permissions.rb +2 -2
  38. data/reactive_record_test_app/Gemfile +6 -2
  39. data/reactive_record_test_app/Gemfile.lock +120 -60
  40. data/reactive_record_test_app/app/assets/javascripts/application.rb +3 -5
  41. data/reactive_record_test_app/app/assets/javascripts/bigdecimal.rb +1 -0
  42. data/reactive_record_test_app/app/assets/javascripts/reactive_record_config.js +2 -2
  43. data/reactive_record_test_app/app/controllers/application_controller.rb +3 -3
  44. data/reactive_record_test_app/app/controllers/home_controller.rb +1 -1
  45. data/reactive_record_test_app/app/models/models.rb.erb +6 -0
  46. data/reactive_record_test_app/config/application.rb +2 -0
  47. data/reactive_record_test_app/config/environments/development.rb +1 -1
  48. data/reactive_record_test_app/config/routes.rb +1 -2
  49. data/reactive_record_test_app/db/seeds.rb +6 -0
  50. data/reactive_record_test_app/script/rails +0 -0
  51. data/reactive_record_test_app/spec-opal/active-record/rendering_spec.rb +11 -2
  52. data/reactive_record_test_app/spec-opal/active-record/save_spec.rb +3 -4
  53. data/reactive_record_test_app/spec-opal/spec_helper.js.rb +1 -1
  54. data/reactive_record_test_app/spec-opal/test_spec.rb +7 -0
  55. data/reactive_record_test_app/spec_dont_run/README.md +7 -0
  56. data/reactive_record_test_app/{spec-opal/active-record → spec_dont_run/active_record_broken}/permissions_spec.rb +0 -0
  57. data/reactive_record_test_app/{spec-opal/active-record → spec_dont_run/active_record_broken}/prerendering_spec.rb +1 -0
  58. data/spec/{synchromesh/aaa-unit_tests/connection_spec.rb → batch1/aaa-unit_tests/connection_movedspec.rb} +0 -0
  59. data/spec/{synchromesh → batch1}/aaa-unit_tests/dummy_value_spec.rb +2 -2
  60. data/spec/{synchromesh → batch1}/column_types/column_type_spec.rb +2 -2
  61. data/spec/{synchromesh → batch1}/crud_access_regulation/broadcast_controls_access_spec.rb +1 -1
  62. data/spec/{synchromesh → batch1}/crud_access_regulation/model_policies_spec.rb +6 -6
  63. data/spec/batch1/misc/access_like_hash_spec.rb +43 -0
  64. data/spec/batch1/misc/while_loading_spec.rb +196 -0
  65. data/spec/{synchromesh → batch1}/policies/regulate_all_broadcasts_spec.rb +12 -12
  66. data/spec/{synchromesh → batch1}/policies/regulate_broadcast_spec.rb +25 -25
  67. data/spec/{synchromesh/integration → batch2}/authorization_spec.rb +8 -7
  68. data/spec/{synchromesh/integration → batch2}/default_scope_spec.rb +2 -2
  69. data/spec/{synchromesh/integration → batch2}/has_many_through_spec.rb +2 -2
  70. data/spec/{synchromesh/integration → batch2}/relationships_spec.rb +3 -3
  71. data/spec/{reactive_record → batch3}/auto_load_itself_spec.rb +1 -1
  72. data/spec/{reactive_record → batch3}/edge_cases_spec.rb +1 -1
  73. data/spec/{reactive_record → batch3}/finder_method_spec.rb +1 -1
  74. data/spec/{reactive_record → batch3}/many_to_many_spec.rb +2 -2
  75. data/spec/{reactive_record → batch3}/pry_rescue_xspec.rb +0 -0
  76. data/{examples/action-cable-production-mode/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css → spec/batch3/readme.txt} +0 -0
  77. data/spec/{reactive_record → batch3}/revert_spec.rb +2 -2
  78. data/spec/{reactive_record → batch3}/save_while_loading_spec.rb +1 -1
  79. data/spec/{reactive_record → batch3}/update_associations_spec.rb +2 -2
  80. data/spec/{reactive_record → batch3}/update_scopes_spec.rb +2 -2
  81. data/spec/{synchromesh/integration → batch4}/saving_during_commit_spec.rb +2 -2
  82. data/spec/{synchromesh/integration → batch4}/scope_spec.rb +30 -2
  83. data/spec/{synchromesh/examples → batch4}/scoped_todos_spec.rb +3 -3
  84. data/spec/{synchromesh/integration → batch4}/synchromesh_spec.rb +2 -2
  85. data/spec/{synchromesh/examples → examples}/dictionary.rb +2 -2
  86. data/spec/{synchromesh/examples → examples}/dictionary_with_client_scopes.rb +2 -2
  87. data/spec/{synchromesh/examples → examples}/random_examples.rb +1 -1
  88. data/spec/{reactive_record/play.rb → play_ground.rb} +0 -0
  89. data/spec/{reactive_record/factory.rb → reactive_record_factory.rb} +0 -0
  90. data/spec/spec_helper.rb +3 -2
  91. data/spec/test_app/Gemfile +8 -3
  92. data/spec/test_app/Gemfile.lock +114 -64
  93. data/spec/test_app/app/views/components.rb +1 -2
  94. data/spec/test_app/config/application.rb +2 -0
  95. data/spec/test_app/config/routes.rb +1 -1
  96. data/spec/{synchromesh/integration/test_components.rb → test_components.rb} +0 -0
  97. metadata +144 -137
  98. data/app/controllers/reactive_record/application_controller.rb +0 -4
  99. data/app/controllers/reactive_record/reactive_record_controller.rb +0 -49
  100. data/config/routes.rb +0 -7
  101. data/examples/action-cable-production-mode/public/assets/application-90043e04e9e784054fd08159fa7aafe5e23d3ffb31584b1bea1e47043c9cfb5a.js +0 -50
  102. data/examples/action-cable-production-mode/public/assets/application-90043e04e9e784054fd08159fa7aafe5e23d3ffb31584b1bea1e47043c9cfb5a.js.gz +0 -0
  103. data/examples/action-cable-production-mode/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz +0 -0
  104. data/examples/action-cable-production-mode/tmp/.keep +0 -0
  105. data/examples/action-cable/log/.keep +0 -0
  106. data/examples/action-cable/tmp/.keep +0 -0
  107. data/examples/pusher-fake/log/.keep +0 -0
  108. data/examples/pusher-fake/tmp/.keep +0 -0
  109. data/examples/pusher/log/.keep +0 -0
  110. data/examples/pusher/tmp/.keep +0 -0
  111. data/examples/simple-poller/log/.keep +0 -0
  112. data/examples/simple-poller/tmp/.keep +0 -0
  113. data/examples/word-game/log/.keep +0 -0
  114. data/examples/word-game/tmp/.keep +0 -0
  115. data/examples/words/log/.keep +0 -0
  116. data/examples/words/tmp/.keep +0 -0
  117. data/lib/reactive_record/version.rb +0 -3
  118. data/lib/sources/hyper-mesh/pusher.js +0 -98
  119. data/lib/synchromesh/action_cable.rb +0 -39
  120. data/lib/synchromesh/client_drivers.rb +0 -357
  121. data/lib/synchromesh/configuration.rb +0 -40
  122. data/lib/synchromesh/connection.rb +0 -170
  123. data/lib/synchromesh/policy.rb +0 -504
  124. data/lib/synchromesh/synchromesh.rb +0 -159
  125. data/lib/synchromesh/synchromesh_controller.rb +0 -162
  126. data/reactive_record_test_app/README.rdoc +0 -261
  127. data/reactive_record_test_app/app/assets/javascripts/components/another_component.rb +0 -24
  128. data/reactive_record_test_app/app/assets/javascripts/components/empty_component.rb +0 -6
  129. data/reactive_record_test_app/app/assets/javascripts/components/todo_item_component.js.rb +0 -16
  130. data/reactive_record_test_app/app/assets/javascripts/components/todos_component.js.rb +0 -42
  131. data/reactive_record_test_app/app/assets/javascripts/components/todos_main_component.rb +0 -49
  132. data/reactive_record_test_app/app/assets/javascripts/react_js_test_only.js +0 -21618
  133. data/reactive_record_test_app/app/assets/javascripts/spec/reactive_record_xspec.js.rb +0 -42
  134. data/reactive_record_test_app/app/controllers/test_controller.rb +0 -7
  135. data/reactive_record_test_app/app/mailers/.gitkeep +0 -0
  136. data/reactive_record_test_app/app/models/models.rb +0 -1
  137. data/reactive_record_test_app/app/policies/application_policy.rb +0 -5
  138. data/reactive_record_test_app/app/views/components.rb +0 -4
  139. data/reactive_record_test_app/app/views/components/test.rb +0 -18
  140. data/reactive_record_test_app/app/views/home/index.html.erb +0 -1
  141. data/reactive_record_test_app/app/views/layouts/application.html.erb +0 -17
  142. data/reactive_record_test_app/config/environments/production.rb +0 -70
  143. data/reactive_record_test_app/config/environments/test.rb +0 -41
  144. data/spec/synchromesh/integration/transports_spec.rb +0 -308
  145. data/spec/synchromesh/policies/auto_connect_spec.rb +0 -60
  146. data/spec/synchromesh/policies/auto_loader_spec.rb +0 -34
  147. data/spec/synchromesh/policies/policy_methods_spec.rb +0 -85
  148. data/spec/synchromesh/policies/regulate_class_connection_spec.rb +0 -50
  149. data/spec/synchromesh/policies/regulate_instance_connection_spec.rb +0 -66
  150. data/spec/test_app/log/.keep +0 -0
@@ -32,8 +32,8 @@ describe "regulate_broadcast" do
32
32
  end
33
33
  attr_accessor :id, :attrA, :attrB, :attrC, :attrD, :attrE
34
34
  end
35
- allow(HyperMesh::Connection).to receive(:active).and_return(['Application', 'TestModel1-1', 'TestModel1-7', 'TestModel2-8'])
36
- allow_any_instance_of(HyperMesh::InternalPolicy).to receive(:id).and_return(:unique_broadcast_id)
35
+ allow(Hyperloop::Connection).to receive(:active).and_return(['Application', 'TestModel1-1', 'TestModel1-7', 'TestModel2-8'])
36
+ allow_any_instance_of(Hyperloop::InternalPolicy).to receive(:id).and_return(:unique_broadcast_id)
37
37
  end
38
38
 
39
39
  it "will broadcast the instance policies for a model" do
@@ -44,7 +44,7 @@ describe "regulate_broadcast" do
44
44
  end
45
45
  end
46
46
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
47
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
47
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
48
48
  {
49
49
  broadcast_id: :unique_broadcast_id,
50
50
  channel: 'TestModel1-1',
@@ -64,7 +64,7 @@ describe "regulate_broadcast" do
64
64
  end
65
65
  end
66
66
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
67
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.
67
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.
68
68
  to raise_error("TestModel1 instance broadcast policy not sent to any channel")
69
69
  end
70
70
 
@@ -77,7 +77,7 @@ describe "regulate_broadcast" do
77
77
  end
78
78
  end
79
79
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
80
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
80
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
81
81
  {
82
82
  broadcast_id: :unique_broadcast_id,
83
83
  channel: 'TestModel1-1',
@@ -98,7 +98,7 @@ describe "regulate_broadcast" do
98
98
  end
99
99
  end
100
100
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
101
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
101
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
102
102
  {
103
103
  broadcast_id: :unique_broadcast_id,
104
104
  channel: 'TestModel1-1',
@@ -127,7 +127,7 @@ describe "regulate_broadcast" do
127
127
  end
128
128
  end
129
129
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
130
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
130
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
131
131
  {
132
132
  broadcast_id: :unique_broadcast_id,
133
133
  channel: 'TestModel1-1',
@@ -157,7 +157,7 @@ describe "regulate_broadcast" do
157
157
  end
158
158
  end
159
159
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
160
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
160
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
161
161
  {
162
162
  broadcast_id: :unique_broadcast_id,
163
163
  channel: 'TestModel1-1',
@@ -190,7 +190,7 @@ describe "regulate_broadcast" do
190
190
  end
191
191
  end
192
192
  model = TestModel1.new(id: 1, attr1: 1, attr2: 2, attr3: 3, attr4: 4, attr5: 5)
193
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
193
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
194
194
  {
195
195
  broadcast_id: :unique_broadcast_id,
196
196
  channel: 'TestModel1-1',
@@ -222,7 +222,7 @@ describe "regulate_broadcast" do
222
222
  end
223
223
  end
224
224
  model = TestModel1.new(id: 1, attr1: 1, attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
225
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
225
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
226
226
  {
227
227
  broadcast_id: :unique_broadcast_id,
228
228
  channel: 'TestModel1-1',
@@ -233,7 +233,7 @@ describe "regulate_broadcast" do
233
233
  }
234
234
  )
235
235
  model = TestModel1.new(id: 1, attr1: 1, attr2: "NO", attr3: 3, attr4: 4, attr5: 5)
236
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
236
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
237
237
  end
238
238
 
239
239
  it "will adds the obj method to the policy which points back to the model being broadcast" do
@@ -248,7 +248,7 @@ describe "regulate_broadcast" do
248
248
  end
249
249
  end
250
250
  model = TestModel1.new(id: 1, attr1: 1, attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
251
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
251
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
252
252
  {
253
253
  broadcast_id: :unique_broadcast_id,
254
254
  channel: 'TestModel1-1',
@@ -259,7 +259,7 @@ describe "regulate_broadcast" do
259
259
  }
260
260
  )
261
261
  model = TestModel1.new(id: 1, attr1: 1, attr2: "NO", attr3: 3, attr4: 4, attr5: 5)
262
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
262
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
263
263
  end
264
264
  it "will not broadcast an empty record" do
265
265
  stub_const "TestModel1Policy", Class.new
@@ -273,7 +273,7 @@ describe "regulate_broadcast" do
273
273
  end
274
274
  end
275
275
  model = TestModel1.new(id: 1, attr1: 1, attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
276
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
276
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
277
277
  {
278
278
  broadcast_id: :unique_broadcast_id,
279
279
  channel: 'TestModel1-1',
@@ -284,7 +284,7 @@ describe "regulate_broadcast" do
284
284
  }
285
285
  )
286
286
  model = TestModel1.new(id: 1, attr1: 1, attr2: "NO", attr3: 3, attr4: 4, attr5: 5)
287
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
287
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.not_to yield_control
288
288
  end
289
289
  it "will apply the same policy to several models" do
290
290
  stub_const "ApplicationPolicy", Class.new
@@ -295,7 +295,7 @@ describe "regulate_broadcast" do
295
295
  end
296
296
  model1 = TestModel1.new(id: 7, attr1: 1)
297
297
  model2 = TestModel2.new(id: 8, attrA: 1)
298
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model1, &b) }.to yield_successive_args(
298
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model1, &b) }.to yield_successive_args(
299
299
  {
300
300
  broadcast_id: :unique_broadcast_id,
301
301
  channel: 'TestModel1-7',
@@ -305,7 +305,7 @@ describe "regulate_broadcast" do
305
305
  previous_changes: {id: 7}
306
306
  }
307
307
  )
308
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model2, &b) }.to yield_successive_args(
308
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model2, &b) }.to yield_successive_args(
309
309
  {
310
310
  broadcast_id: :unique_broadcast_id,
311
311
  channel: 'TestModel2-8',
@@ -318,23 +318,23 @@ describe "regulate_broadcast" do
318
318
 
319
319
  end
320
320
 
321
- it "exposes the policy methods on the synchromesh_internal_policy_object" do
321
+ it "exposes the policy methods on the hyperloop_internal_policy_object" do
322
322
  stub_const "TestModel1Policy", Class.new
323
323
  stub_const "Application", Class.new
324
324
  TestModel1Policy.class_eval do
325
325
  regulate_broadcast do | policy |
326
- case policy.synchromesh_internal_policy_object.obj.attr1
326
+ case policy.hyperloop_internal_policy_object.obj.attr1
327
327
  when "send_all"
328
- policy.synchromesh_internal_policy_object.send_all.to(self)
328
+ policy.hyperloop_internal_policy_object.send_all.to(self)
329
329
  when "send_all_but"
330
- policy.synchromesh_internal_policy_object.send_all_but(:attr2).to(self)
330
+ policy.hyperloop_internal_policy_object.send_all_but(:attr2).to(self)
331
331
  when "send_only"
332
- policy.synchromesh_internal_policy_object.send_only(:attr2).to(self)
332
+ policy.hyperloop_internal_policy_object.send_only(:attr2).to(self)
333
333
  end
334
334
  end
335
335
  end
336
336
  model = TestModel1.new(id: 1, attr1: "send_all", attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
337
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
337
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
338
338
  {
339
339
  broadcast_id: :unique_broadcast_id,
340
340
  channel: 'TestModel1-1',
@@ -345,7 +345,7 @@ describe "regulate_broadcast" do
345
345
  }
346
346
  )
347
347
  model = TestModel1.new(id: 1, attr1: "send_all_but", attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
348
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
348
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
349
349
  {
350
350
  broadcast_id: :unique_broadcast_id,
351
351
  channel: 'TestModel1-1',
@@ -356,7 +356,7 @@ describe "regulate_broadcast" do
356
356
  }
357
357
  )
358
358
  model = TestModel1.new(id: 1, attr1: "send_only", attr2: "YES", attr3: 3, attr4: 4, attr5: 5)
359
- expect { |b| HyperMesh::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
359
+ expect { |b| Hyperloop::InternalPolicy.regulate_broadcast(model, &b) }.to yield_successive_args(
360
360
  {
361
361
  broadcast_id: :unique_broadcast_id,
362
362
  channel: 'TestModel1-1',
@@ -1,10 +1,10 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "authorization integration", js: true do
5
5
 
6
6
  before(:all) do
7
- # HyperMesh.configuration do |config|
7
+ # Hyperloop.configuration do |config|
8
8
  # config.transport = :simple_poller
9
9
  # # slow down the polling so wait_for_ajax works
10
10
  # config.opts = { seconds_between_poll: 2 }
@@ -17,7 +17,7 @@ describe "authorization integration", js: true do
17
17
  Pusher.secret = "MY_TEST_SECRET"
18
18
  require "pusher-fake/support/base"
19
19
 
20
- HyperMesh.configuration do |config|
20
+ Hyperloop.configuration do |config|
21
21
  config.transport = :pusher
22
22
  config.channel_prefix = "synchromesh"
23
23
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -46,6 +46,7 @@ describe "authorization integration", js: true do
46
46
  before(:each) do
47
47
  # spec_helper resets the policy system after each test so we have to setup
48
48
  # before each test
49
+ User
49
50
  stub_const "User", Class.new
50
51
  User.class_eval do
51
52
  include ActiveModel::Model
@@ -68,7 +69,7 @@ describe "authorization integration", js: true do
68
69
  wait_for_ajax
69
70
  model1.attributes_on_client(page).should eq({id: 1})
70
71
  ApplicationController.acting_user = User.new(name: "fred")
71
- page.evaluate_ruby('HyperMesh.connect("TestApplication")')
72
+ page.evaluate_ruby('Hyperloop.connect("TestApplication")')
72
73
  wait_for_ajax
73
74
  model1.update_attribute(:test_attribute, 'george')
74
75
  wait_for_ajax
@@ -78,7 +79,7 @@ describe "authorization integration", js: true do
78
79
  updated_at: model1.updated_at.localtime.strftime('%Y-%m-%dT%H:%M:%S%z')
79
80
  })
80
81
  ApplicationController.acting_user = User.new(name: "george")
81
- page.evaluate_ruby("HyperMesh.connect(['TestModel', #{model1.id}])")
82
+ page.evaluate_ruby("Hyperloop.connect(['TestModel', #{model1.id}])")
82
83
  wait_for_ajax
83
84
  model1.update_attribute(:completed, true)
84
85
  wait_for_ajax
@@ -92,7 +93,7 @@ describe "authorization integration", js: true do
92
93
  it "will fail on illegal class connections" do
93
94
  mount "TestComponent2"
94
95
  model1 = FactoryGirl.create(:test_model, test_attribute: "hello")
95
- page.evaluate_ruby('HyperMesh.connect("TestApplication")')
96
+ page.evaluate_ruby('Hyperloop.connect("TestApplication")')
96
97
  model1.update_attribute(:test_attribute, 'george')
97
98
  wait_for_ajax
98
99
  model1.attributes_on_client(page).should eq({id: 1})
@@ -102,7 +103,7 @@ describe "authorization integration", js: true do
102
103
  mount "TestComponent2"
103
104
  model1 = FactoryGirl.create(:test_model, test_attribute: "george")
104
105
  ApplicationController.acting_user = User.new(name: "fred")
105
- page.evaluate_ruby("HyperMesh.connect(['TestModel', #{model1.id}])")
106
+ page.evaluate_ruby("Hyperloop.connect(['TestModel', #{model1.id}])")
106
107
  model1.update_attribute(:completed, true)
107
108
  wait_for_ajax
108
109
  model1.attributes_on_client(page).should eq({id: 1})
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "default_scope" do
5
5
 
@@ -13,7 +13,7 @@ describe "default_scope" do
13
13
  Pusher.secret = "MY_TEST_SECRET"
14
14
  require "pusher-fake/support/base"
15
15
 
16
- HyperMesh.configuration do |config|
16
+ Hyperloop.configuration do |config|
17
17
  config.transport = :pusher
18
18
  config.channel_prefix = "synchromesh"
19
19
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
  require 'rspec-steps'
4
4
 
5
5
  RSpec::Steps.steps "has_many through relationships", js: true do
@@ -12,7 +12,7 @@ RSpec::Steps.steps "has_many through relationships", js: true do
12
12
  Pusher.secret = "MY_TEST_SECRET"
13
13
  require "pusher-fake/support/base"
14
14
 
15
- HyperMesh.configuration do |config|
15
+ Hyperloop.configuration do |config|
16
16
  config.transport = :pusher
17
17
  config.channel_prefix = "synchromesh"
18
18
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "synchronizing relationships", js: true do
5
5
 
@@ -11,7 +11,7 @@ describe "synchronizing relationships", js: true do
11
11
  Pusher.secret = "MY_TEST_SECRET"
12
12
  require "pusher-fake/support/base"
13
13
 
14
- HyperMesh.configuration do |config|
14
+ Hyperloop.configuration do |config|
15
15
  config.transport = :pusher
16
16
  config.channel_prefix = "synchromesh"
17
17
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -96,7 +96,7 @@ describe "synchronizing relationships", js: true do
96
96
  end
97
97
 
98
98
  it "adding child to a new model on client after render" do
99
- # HyperMesh.configuration do |config|
99
+ # Hyperloop.configuration do |config|
100
100
  # #config.transport = :none
101
101
  # end
102
102
  m = FactoryGirl.create(:test_model)
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "HyperMesh.load", js: true do
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "reactive-record edge cases", js: true do
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
  require 'rspec-steps'
4
4
 
5
5
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
3
- require 'reactive_record/factory'
2
+ require 'test_components'
3
+ require 'reactive_record_factory'
4
4
 
5
5
  describe "many to many associations", js: true do
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
3
- require 'reactive_record/factory'
2
+ require 'test_components'
3
+ require 'reactive_record_factory'
4
4
  require 'rspec-steps'
5
5
 
6
6
  RSpec::Steps.steps "reverting records", js: true do
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "save while loading", js: true do
5
5
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
3
- require 'reactive_record/factory'
2
+ require 'test_components'
3
+ require 'reactive_record_factory'
4
4
  require 'rspec-steps'
5
5
 
6
6
  RSpec::Steps.steps "updating associations", js: true do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
3
- require 'reactive_record/factory'
2
+ require 'test_components'
3
+ require 'reactive_record_factory'
4
4
  require 'rspec-steps'
5
5
 
6
6
  RSpec::Steps.steps "updating scopes", js: true do
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
  require 'rspec-steps'
4
4
 
5
5
  describe "saving during commit", js: true do
@@ -12,7 +12,7 @@ describe "saving during commit", js: true do
12
12
  Pusher.secret = "MY_TEST_SECRET"
13
13
  require "pusher-fake/support/base"
14
14
 
15
- HyperMesh.configuration do |config|
15
+ Hyperloop.configuration do |config|
16
16
  config.transport = :pusher
17
17
  config.channel_prefix = "synchromesh"
18
18
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'synchromesh/integration/test_components'
2
+ require 'test_components'
3
3
 
4
4
  describe "synchronized scopes", js: true do
5
5
 
@@ -11,7 +11,7 @@ describe "synchronized scopes", js: true do
11
11
  Pusher.secret = "MY_TEST_SECRET"
12
12
  require "pusher-fake/support/base"
13
13
 
14
- HyperMesh.configuration do |config|
14
+ Hyperloop.configuration do |config|
15
15
  config.transport = :pusher
16
16
  config.channel_prefix = "synchromesh"
17
17
  config.opts = {app_id: Pusher.app_id, key: Pusher.key, secret: Pusher.secret}.merge(PusherFake.configuration.web_options)
@@ -185,6 +185,34 @@ describe "synchronized scopes", js: true do
185
185
  page.should have_content('scope1.scope2.count = 1')
186
186
  end
187
187
 
188
+ it 'collections passed from server will not interfere with client associations' do
189
+ user = FactoryGirl.create(:user)
190
+ 5.times do
191
+ FactoryGirl.create(:todo, title: 'active', created_by_id: user.id)
192
+ end
193
+
194
+ isomorphic do
195
+ Todo.class_eval do
196
+ scope :active, -> { where('title LIKE ?', 'active') }
197
+ end
198
+ end
199
+
200
+ todos = user.authored_todos.active
201
+
202
+ mount 'TestComponent2', todos: todos do
203
+ class TestComponent2 < React::Component::Base
204
+ param :todos, type: [Todo]
205
+ render(:div) do
206
+ P { "params.todos = #{params.todos.count}" }
207
+ P { "params.user.authored_todos.active = #{User.find(1).authored_todos.active.count}" }
208
+ end
209
+ end
210
+ end
211
+
212
+ page.should have_content('params.todos = 5')
213
+ page.should have_content('params.user.authored_todos.active = 5')
214
+ end
215
+
188
216
  context 'basic joins' do
189
217
 
190
218
  it 'will not update a joined scope without a joins option' do