volt 0.8.15 → 0.8.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +11 -0
  3. data/CHANGELOG.md +11 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +2 -3
  6. data/Rakefile +1 -4
  7. data/VERSION +1 -1
  8. data/app/volt/controllers/notices_controller.rb +1 -1
  9. data/app/volt/tasks/live_query/data_store.rb +7 -7
  10. data/app/volt/tasks/live_query/live_query.rb +7 -9
  11. data/app/volt/tasks/live_query/live_query_pool.rb +13 -12
  12. data/app/volt/tasks/live_query/query_tracker.rb +4 -5
  13. data/app/volt/tasks/query_tasks.rb +9 -11
  14. data/app/volt/tasks/store_tasks.rb +4 -4
  15. data/app/volt/tasks/user_tasks.rb +1 -1
  16. data/bin/volt +2 -2
  17. data/lib/volt.rb +3 -7
  18. data/lib/volt/assets/test.rb +1 -2
  19. data/lib/volt/benchmark/benchmark.rb +3 -3
  20. data/lib/volt/boot.rb +1 -1
  21. data/lib/volt/cli.rb +18 -18
  22. data/lib/volt/cli/asset_compile.rb +8 -10
  23. data/lib/volt/cli/generate.rb +9 -11
  24. data/lib/volt/cli/new_gem.rb +51 -51
  25. data/lib/volt/config.rb +2 -3
  26. data/lib/volt/console.rb +1 -1
  27. data/lib/volt/controllers/model_controller.rb +6 -6
  28. data/lib/volt/data_stores/data_store.rb +1 -1
  29. data/lib/volt/data_stores/mongo_driver.rb +1 -1
  30. data/lib/volt/extra_core/array.rb +2 -2
  31. data/lib/volt/extra_core/blank.rb +1 -2
  32. data/lib/volt/extra_core/extra_core.rb +1 -1
  33. data/lib/volt/extra_core/inflector/methods.rb +0 -1
  34. data/lib/volt/extra_core/logger.rb +13 -7
  35. data/lib/volt/extra_core/numeric.rb +1 -1
  36. data/lib/volt/extra_core/string.rb +7 -7
  37. data/lib/volt/extra_core/stringify_keys.rb +5 -5
  38. data/lib/volt/models.rb +2 -2
  39. data/lib/volt/models/array_model.rb +18 -19
  40. data/lib/volt/models/cursor.rb +0 -1
  41. data/lib/volt/models/model.rb +17 -35
  42. data/lib/volt/models/model_hash_behaviour.rb +0 -2
  43. data/lib/volt/models/model_state.rb +1 -1
  44. data/lib/volt/models/model_wrapper.rb +1 -1
  45. data/lib/volt/models/persistors/array_store.rb +26 -13
  46. data/lib/volt/models/persistors/base.rb +1 -1
  47. data/lib/volt/models/persistors/flash.rb +2 -2
  48. data/lib/volt/models/persistors/local_store.rb +2 -3
  49. data/lib/volt/models/persistors/model_store.rb +7 -6
  50. data/lib/volt/models/persistors/params.rb +2 -2
  51. data/lib/volt/models/persistors/query/query_listener.rb +2 -0
  52. data/lib/volt/models/persistors/query/query_listener_pool.rb +1 -1
  53. data/lib/volt/models/persistors/store.rb +1 -2
  54. data/lib/volt/models/persistors/store_state.rb +2 -3
  55. data/lib/volt/models/url.rb +17 -16
  56. data/lib/volt/models/validations.rb +11 -14
  57. data/lib/volt/models/validators/length_validator.rb +3 -3
  58. data/lib/volt/models/validators/presence_validator.rb +2 -2
  59. data/lib/volt/page/bindings/attribute_binding.rb +2 -3
  60. data/lib/volt/page/bindings/base_binding.rb +1 -1
  61. data/lib/volt/page/bindings/each_binding.rb +8 -9
  62. data/lib/volt/page/bindings/event_binding.rb +2 -3
  63. data/lib/volt/page/bindings/template_binding.rb +8 -7
  64. data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +2 -1
  65. data/lib/volt/page/channel.rb +10 -10
  66. data/lib/volt/page/channel_stub.rb +1 -1
  67. data/lib/volt/page/document.rb +0 -1
  68. data/lib/volt/page/document_events.rb +4 -4
  69. data/lib/volt/page/page.rb +26 -19
  70. data/lib/volt/page/string_template_renderer.rb +2 -2
  71. data/lib/volt/page/sub_context.rb +10 -4
  72. data/lib/volt/page/targets/attribute_section.rb +1 -1
  73. data/lib/volt/page/targets/attribute_target.rb +1 -2
  74. data/lib/volt/page/targets/base_section.rb +4 -4
  75. data/lib/volt/page/targets/binding_document/base_node.rb +0 -1
  76. data/lib/volt/page/targets/binding_document/component_node.rb +4 -5
  77. data/lib/volt/page/targets/dom_section.rb +21 -22
  78. data/lib/volt/page/targets/dom_target.rb +1 -1
  79. data/lib/volt/page/targets/dom_template.rb +11 -12
  80. data/lib/volt/page/targets/helpers/comment_searchers.rb +7 -8
  81. data/lib/volt/page/tasks.rb +0 -1
  82. data/lib/volt/page/template_renderer.rb +1 -1
  83. data/lib/volt/page/url_tracker.rb +3 -3
  84. data/lib/volt/reactive/computation.rb +5 -11
  85. data/lib/volt/reactive/dependency.rb +1 -3
  86. data/lib/volt/reactive/eventable.rb +17 -4
  87. data/lib/volt/reactive/hash_dependency.rb +1 -0
  88. data/lib/volt/reactive/reactive_accessors.rb +0 -1
  89. data/lib/volt/reactive/reactive_array.rb +20 -25
  90. data/lib/volt/reactive/reactive_hash.rb +3 -3
  91. data/lib/volt/router/routes.rb +11 -13
  92. data/lib/volt/server.rb +17 -17
  93. data/lib/volt/server/component_handler.rb +2 -2
  94. data/lib/volt/server/component_templates.rb +8 -8
  95. data/lib/volt/server/html_parser/attribute_scope.rb +9 -10
  96. data/lib/volt/server/html_parser/if_view_scope.rb +2 -2
  97. data/lib/volt/server/html_parser/sandlebars_parser.rb +14 -14
  98. data/lib/volt/server/html_parser/textarea_scope.rb +1 -2
  99. data/lib/volt/server/html_parser/view_handler.rb +1 -1
  100. data/lib/volt/server/html_parser/view_parser.rb +1 -1
  101. data/lib/volt/server/html_parser/view_scope.rb +10 -10
  102. data/lib/volt/server/rack/asset_files.rb +15 -16
  103. data/lib/volt/server/rack/component_code.rb +2 -2
  104. data/lib/volt/server/rack/component_html_renderer.rb +0 -1
  105. data/lib/volt/server/rack/component_paths.rb +13 -10
  106. data/lib/volt/server/rack/index_files.rb +4 -4
  107. data/lib/volt/server/rack/opal_files.rb +4 -5
  108. data/lib/volt/server/rack/source_map_server.rb +3 -3
  109. data/lib/volt/server/socket_connection_handler.rb +3 -4
  110. data/lib/volt/server/socket_connection_handler_stub.rb +1 -1
  111. data/lib/volt/spec/setup.rb +3 -3
  112. data/lib/volt/store/mongo.rb +2 -2
  113. data/lib/volt/tasks/task_handler.rb +3 -3
  114. data/lib/volt/utils/generic_counting_pool.rb +2 -2
  115. data/lib/volt/utils/generic_pool.rb +7 -8
  116. data/lib/volt/utils/local_storage.rb +4 -4
  117. data/lib/volt/volt/environment.rb +1 -1
  118. data/spec/apps/file_loading/app/shared/config/dependencies.rb +1 -1
  119. data/spec/apps/kitchen_sink/Gemfile +0 -2
  120. data/spec/apps/kitchen_sink/app/main/config/routes.rb +5 -5
  121. data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +7 -6
  122. data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +3 -4
  123. data/spec/controllers/reactive_accessors_spec.rb +4 -4
  124. data/spec/extra_core/inflector_spec.rb +1 -1
  125. data/spec/extra_core/string_transformation_test_cases.rb +23 -24
  126. data/spec/extra_core/string_transformations_spec.rb +11 -12
  127. data/spec/integration/bindings_spec.rb +15 -15
  128. data/spec/integration/list_spec.rb +12 -13
  129. data/spec/integration/templates_spec.rb +3 -3
  130. data/spec/models/model_spec.rb +74 -80
  131. data/spec/models/persistors/params_spec.rb +2 -2
  132. data/spec/models/persistors/store_spec.rb +4 -4
  133. data/spec/models/validations_spec.rb +14 -23
  134. data/spec/page/bindings/content_binding_spec.rb +7 -8
  135. data/spec/page/bindings/template_binding_spec.rb +22 -24
  136. data/spec/page/sub_context_spec.rb +2 -2
  137. data/spec/reactive/computation_spec.rb +3 -3
  138. data/spec/reactive/reactive_array_spec.rb +12 -12
  139. data/spec/router/routes_spec.rb +45 -48
  140. data/spec/server/html_parser/sandlebars_parser_spec.rb +42 -42
  141. data/spec/server/html_parser/view_parser_spec.rb +132 -153
  142. data/spec/server/rack/asset_files_spec.rb +9 -8
  143. data/spec/server/rack/component_paths_spec.rb +5 -5
  144. data/spec/server/rack/rack_requests_spec.rb +3 -3
  145. data/spec/spec_helper.rb +1 -1
  146. data/spec/tasks/live_query_spec.rb +4 -5
  147. data/spec/tasks/query_tasks.rb +2 -4
  148. data/spec/tasks/query_tracker_spec.rb +29 -29
  149. data/spec/templates/targets/binding_document/component_node_spec.rb +1 -1
  150. data/spec/utils/generic_counting_pool_spec.rb +4 -4
  151. data/spec/utils/generic_pool_spec.rb +12 -12
  152. data/templates/component/config/routes.rb +2 -2
  153. data/templates/component/controllers/main_controller.rb +7 -6
  154. data/templates/newgem/app/newgem/config/dependencies.rb +1 -1
  155. data/templates/newgem/app/newgem/config/routes.rb +1 -1
  156. data/templates/project/app/main/config/routes.rb +2 -2
  157. data/templates/project/app/main/controllers/main_controller.rb +7 -6
  158. data/templates/project/spec/sample_spec.rb +2 -2
  159. data/volt.gemspec +32 -33
  160. metadata +3 -4
  161. data/lib/volt/extra_core/log.rb +0 -56
  162. data/lib/volt/extra_core/try.rb +0 -31
@@ -1,24 +1,23 @@
1
1
  if ENV['BROWSER'] == 'firefox'
2
2
  require 'spec_helper'
3
3
 
4
- describe "todo example spec", :type => :feature do
4
+ describe 'todo example spec', type: :feature do
5
5
  before do
6
6
  visit '/'
7
7
 
8
8
  click_link 'Todos'
9
9
 
10
-
11
- fill_in('newtodo', :with => "Item 1\n")
12
- fill_in('newtodo', :with => "Item 2\n")
13
- fill_in('newtodo', :with => "Item 3\n")
10
+ fill_in('newtodo', with: "Item 1\n")
11
+ fill_in('newtodo', with: "Item 2\n")
12
+ fill_in('newtodo', with: "Item 3\n")
14
13
  end
15
14
 
16
- it "should add items to the list" do
15
+ it 'should add items to the list' do
17
16
  expect(find('#todos-table')).to have_content('Item 1')
18
17
  end
19
18
 
20
19
  it 'should strikethrough when the checkbox is checked' do
21
- box = all(:css, "#todos-table input[type=checkbox]")[0]
20
+ box = all(:css, '#todos-table input[type=checkbox]')[0]
22
21
 
23
22
  expect(find('#todos-table')).to_not have_css('td.name.complete')
24
23
 
@@ -35,7 +34,7 @@ if ENV['BROWSER'] == 'firefox'
35
34
  expect(find('#todos-table')).to have_content('Item 3')
36
35
 
37
36
  # Click the middle one
38
- all(:css, "#todos-table button")[1].click
37
+ all(:css, '#todos-table button')[1].click
39
38
 
40
39
  expect(find('#todos-table')).to have_content('Item 1')
41
40
  expect(find('#todos-table')).to_not have_content('Item 2')
@@ -47,22 +46,22 @@ if ENV['BROWSER'] == 'firefox'
47
46
 
48
47
  expect(count).to have_content('0 of 3')
49
48
 
50
- box1 = all(:css, "#todos-table input[type=checkbox]")[0]
49
+ box1 = all(:css, '#todos-table input[type=checkbox]')[0]
51
50
  box1.set(true)
52
51
 
53
52
  expect(count).to have_content('1 of 3')
54
53
 
55
- all(:css, "#todos-table button")[0].click
54
+ all(:css, '#todos-table button')[0].click
56
55
  expect(count).to have_content('0 of 2')
57
56
 
58
- box1 = all(:css, "#todos-table input[type=checkbox]")[0]
57
+ box1 = all(:css, '#todos-table input[type=checkbox]')[0]
59
58
  box1.set(true)
60
59
  expect(count).to have_content('1 of 2')
61
60
 
62
- box2 = all(:css, "#todos-table input[type=checkbox]")[1]
61
+ box2 = all(:css, '#todos-table input[type=checkbox]')[1]
63
62
  box2.set(true)
64
63
 
65
64
  expect(count).to have_content('2 of 2')
66
65
  end
67
66
  end
68
- end
67
+ end
@@ -1,8 +1,8 @@
1
1
  if ENV['BROWSER']
2
2
  require 'spec_helper'
3
3
 
4
- describe "bindings test", :type => :feature do
5
- it "should change the title when changing pages" do
4
+ describe 'bindings test', type: :feature do
5
+ it 'should change the title when changing pages' do
6
6
  visit '/'
7
7
 
8
8
  expect(page).to have_title 'KitchenSink - KitchenSink'
@@ -12,4 +12,4 @@ if ENV['BROWSER']
12
12
 
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -1,24 +1,22 @@
1
1
  require 'spec_helper'
2
2
  require 'volt/models'
3
3
 
4
-
5
4
  class TestItem < Volt::Model
6
5
  end
7
6
 
8
7
  class Item < Volt::Model
9
8
  end
10
9
 
11
-
12
10
  describe Volt::Model do
13
11
 
14
- it "should allow _ methods to be used to store values without predefining them" do
12
+ it 'should allow _ methods to be used to store values without predefining them' do
15
13
  a = Volt::Model.new
16
14
  a._stash = 'yes'
17
15
 
18
16
  expect(a._stash).to eq('yes')
19
17
  end
20
18
 
21
- it "should update other values off the same model" do
19
+ it 'should update other values off the same model' do
22
20
  a = Volt::Model.new
23
21
 
24
22
  values = []
@@ -33,13 +31,13 @@ describe Volt::Model do
33
31
  expect(values).to eq([nil, 'Bob'])
34
32
  end
35
33
 
36
- it "should say unregistered attributes are nil" do
34
+ it 'should say unregistered attributes are nil' do
37
35
  a = Volt::Model.new
38
- b = a._missing == nil
36
+ b = a._missing.nil?
39
37
  expect(b).to eq(true)
40
38
  end
41
39
 
42
- it "should negate nil and false correctly" do
40
+ it 'should negate nil and false correctly' do
43
41
  a = Volt::Model.new
44
42
  expect((!a._missing)).to eq(true)
45
43
 
@@ -55,12 +53,11 @@ describe Volt::Model do
55
53
  expect(a._something.attributes).to eq(nil)
56
54
  end
57
55
 
58
-
59
- it "should trigger changed once when a new value is assigned." do
56
+ it 'should trigger changed once when a new value is assigned.' do
60
57
  a = Volt::Model.new
61
58
 
62
59
  count = 0
63
- -> { a._blue ; count += 1 }.watch!
60
+ -> { a._blue; count += 1 }.watch!
64
61
  expect(count).to eq(1)
65
62
 
66
63
  a._blue = 'one'
@@ -72,15 +69,14 @@ describe Volt::Model do
72
69
  expect(count).to eq(3)
73
70
  end
74
71
 
75
- it "should not trigger changed on other attributes" do
72
+ it 'should not trigger changed on other attributes' do
76
73
  a = Volt::Model.new
77
74
 
78
75
  blue_count = 0
79
76
  green_count = 0
80
77
 
81
-
82
- -> { a._blue ; blue_count += 1 }.watch!
83
- -> { a._green ; green_count += 1 }.watch!
78
+ -> { a._blue; blue_count += 1 }.watch!
79
+ -> { a._green; green_count += 1 }.watch!
84
80
  expect(blue_count).to eq(1)
85
81
  expect(green_count).to eq(1)
86
82
 
@@ -95,7 +91,7 @@ describe Volt::Model do
95
91
  expect(green_count).to eq(2)
96
92
  end
97
93
 
98
- it "should call change through arguments" do
94
+ it 'should call change through arguments' do
99
95
  a = Volt::Model.new
100
96
  a._one = 1
101
97
  a._two = 2
@@ -103,7 +99,7 @@ describe Volt::Model do
103
99
 
104
100
  c = nil
105
101
  count = 0
106
- -> { c = a._one + a._two ; count += 1 }.watch!
102
+ -> { c = a._one + a._two; count += 1 }.watch!
107
103
 
108
104
  expect(count).to eq(1)
109
105
 
@@ -138,15 +134,15 @@ describe Volt::Model do
138
134
 
139
135
  end
140
136
 
141
- it "should trigger changed for any indicies after a deleted index" do
137
+ it 'should trigger changed for any indicies after a deleted index' do
142
138
  model = Volt::Model.new
143
139
 
144
- model._items << {_name: 'One'}
145
- model._items << {_name: 'Two'}
146
- model._items << {_name: 'Three'}
140
+ model._items << { _name: 'One' }
141
+ model._items << { _name: 'Two' }
142
+ model._items << { _name: 'Three' }
147
143
 
148
144
  count = 0
149
- -> { model._items[2] ; count += 1 }.watch!
145
+ -> { model._items[2]; count += 1 }.watch!
150
146
  expect(count).to eq(1)
151
147
 
152
148
  model._items.delete_at(1)
@@ -154,43 +150,43 @@ describe Volt::Model do
154
150
  expect(count).to eq(2)
155
151
  end
156
152
 
157
- it "should change the size and length when an item gets added" do
153
+ it 'should change the size and length when an item gets added' do
158
154
  model = Volt::Model.new
159
155
 
160
- model._items << {_name: 'One'}
156
+ model._items << { _name: 'One' }
161
157
  size = model._items.size
162
158
  length = model._items.length
163
159
 
164
160
  count_size = 0
165
161
  count_length = 0
166
- -> { model._items.size ; count_size += 1 }.watch!
167
- -> { model._items.length ; count_length += 1 }.watch!
162
+ -> { model._items.size; count_size += 1 }.watch!
163
+ -> { model._items.length; count_length += 1 }.watch!
168
164
  expect(count_size).to eq(1)
169
165
  expect(count_length).to eq(1)
170
166
 
171
- model._items << {_name: 'Two'}
167
+ model._items << { _name: 'Two' }
172
168
  Volt::Computation.flush!
173
169
 
174
170
  expect(count_size).to eq(2)
175
171
  expect(count_length).to eq(2)
176
172
  end
177
173
 
178
- it "should add doubly nested arrays" do
174
+ it 'should add doubly nested arrays' do
179
175
  model = Volt::Model.new
180
176
 
181
- model._items << {name: 'Cool', lists: []}
182
- model._items[0]._lists << {name: 'worked'}
177
+ model._items << { name: 'Cool', lists: [] }
178
+ model._items[0]._lists << { name: 'worked' }
183
179
  expect(model._items[0]._lists[0]._name).to eq('worked')
184
180
  end
185
181
 
186
- it "should make pushed subarrays into ArrayModels" do
182
+ it 'should make pushed subarrays into ArrayModels' do
187
183
  model = Volt::Model.new
188
184
 
189
- model._items << {_name: 'Test', _lists: []}
185
+ model._items << { _name: 'Test', _lists: [] }
190
186
  expect(model._items[0]._lists.class).to eq(Volt::ArrayModel)
191
187
  end
192
188
 
193
- it "should make assigned subarrays into ArrayModels" do
189
+ it 'should make assigned subarrays into ArrayModels' do
194
190
  model = Volt::Model.new
195
191
 
196
192
  model._item._name = 'Test'
@@ -198,11 +194,11 @@ describe Volt::Model do
198
194
  expect(model._item._lists.class).to eq(Volt::ArrayModel)
199
195
  end
200
196
 
201
- it "should call changed when a the reference to a submodel is assigned to another value" do
197
+ it 'should call changed when a the reference to a submodel is assigned to another value' do
202
198
  a = Volt::Model.new
203
199
 
204
200
  count = 0
205
- -> { a._blue && a._blue.respond_to?(:green) && a._blue._green ; count += 1 }.watch!
201
+ -> { a._blue && a._blue.respond_to?(:green) && a._blue._green; count += 1 }.watch!
206
202
  expect(count).to eq(1)
207
203
 
208
204
  a._blue._green = 5
@@ -215,17 +211,17 @@ describe Volt::Model do
215
211
  Volt::Computation.flush!
216
212
  expect(count).to eq(3)
217
213
 
218
- a._blue = {green: 50}
214
+ a._blue = { green: 50 }
219
215
  expect(a._blue._green).to eq(50)
220
216
  Volt::Computation.flush!
221
217
  expect(count).to eq(4)
222
218
  end
223
219
 
224
- it "should trigger changed when a value is deleted" do
220
+ it 'should trigger changed when a value is deleted' do
225
221
  a = Volt::Model.new
226
222
 
227
223
  count = 0
228
- -> { a._blue ; count += 1 }.watch!
224
+ -> { a._blue; count += 1 }.watch!
229
225
  expect(count).to eq(1)
230
226
 
231
227
  a._blue = 1
@@ -237,16 +233,15 @@ describe Volt::Model do
237
233
  expect(count).to eq(3)
238
234
  end
239
235
 
240
- it "should let you append nested hashes" do
236
+ it 'should let you append nested hashes' do
241
237
  a = Volt::Model.new
242
238
 
243
- a._items << {name: {text: 'Name'}}
239
+ a._items << { name: { text: 'Name' } }
244
240
 
245
241
  expect(a._items[0]._name._text).to eq('Name')
246
242
  end
247
243
 
248
-
249
- it "should not call added too many times" do
244
+ it 'should not call added too many times' do
250
245
  a = Volt::Model.new
251
246
  a._lists << 1
252
247
 
@@ -258,7 +253,7 @@ describe Volt::Model do
258
253
  expect(count).to eq(1)
259
254
  end
260
255
 
261
- it "should propigate to different branches" do
256
+ it 'should propigate to different branches' do
262
257
  a = Volt::Model.new
263
258
  count = 0
264
259
  -> do
@@ -272,37 +267,37 @@ describe Volt::Model do
272
267
  expect(count).to eq(2)
273
268
  end
274
269
 
275
- describe "paths" do
276
- it "should store the path" do
270
+ describe 'paths' do
271
+ it 'should store the path' do
277
272
  a = Volt::Model.new
278
273
  expect(a._test.path).to eq([:test])
279
- a._test = {_name: 'Yes'}
274
+ a._test = { _name: 'Yes' }
280
275
  expect(a._test.path).to eq([:test])
281
276
 
282
- a._items << {_name: 'Yes'}
277
+ a._items << { _name: 'Yes' }
283
278
  expect(a._items.path).to eq([:items])
284
279
  expect(a._items[0].path).to eq([:items, :[]])
285
280
  end
286
281
 
287
- it "should store the paths when assigned" do
282
+ it 'should store the paths when assigned' do
288
283
  a = Volt::Model.new
289
284
 
290
- a._items = [{_name: 'Cool'}]
285
+ a._items = [{ _name: 'Cool' }]
291
286
 
292
287
  expect(a._items.path).to eq([:items])
293
288
  expect(a._items[0].path).to eq([:items, :[]])
294
289
  end
295
290
 
296
- it "should handle nested paths" do
291
+ it 'should handle nested paths' do
297
292
  a = Volt::Model.new
298
293
 
299
- a._items << {name: 'Cool', lists: [{name: 'One'}, {name: 'Two'}]}
294
+ a._items << { name: 'Cool', lists: [{ name: 'One' }, { name: 'Two' }] }
300
295
 
301
296
  expect(a._items[0]._lists.path).to eq([:items, :[], :lists])
302
297
  expect(a._items[0]._lists[1].path).to eq([:items, :[], :lists, :[]])
303
298
  end
304
299
 
305
- it "should trigger added when added" do
300
+ it 'should trigger added when added' do
306
301
  a = Volt::Model.new
307
302
  count = 0
308
303
  b = a._items
@@ -310,18 +305,18 @@ describe Volt::Model do
310
305
  b.on('added') { count += 1 }
311
306
  expect(count).to eq(0)
312
307
 
313
- b << {_name: 'one'}
314
- b << {_name: 'two'}
308
+ b << { _name: 'one' }
309
+ b << { _name: 'two' }
315
310
 
316
311
  expect(count).to eq(2)
317
312
  end
318
313
  end
319
314
 
320
- it "should trigger on false assign" do
315
+ it 'should trigger on false assign' do
321
316
  a = Volt::Model.new
322
317
  count = 0
323
318
 
324
- -> { count += 1 ; a._complete }.watch!
319
+ -> { count += 1; a._complete }.watch!
325
320
 
326
321
  expect(count).to eq(1)
327
322
 
@@ -334,12 +329,12 @@ describe Volt::Model do
334
329
  expect(count).to eq(3)
335
330
  end
336
331
 
337
- it "should delete from an ArrayModel" do
332
+ it 'should delete from an ArrayModel' do
338
333
  array = Volt::ArrayModel.new([])
339
334
 
340
- array << {name: 'One'}
341
- array << {name: 'Two'}
342
- array << {name: 'Three'}
335
+ array << { name: 'One' }
336
+ array << { name: 'Two' }
337
+ array << { name: 'Three' }
343
338
 
344
339
  expect(array.size).to eq(3)
345
340
 
@@ -350,20 +345,20 @@ describe Volt::Model do
350
345
  expect(array[0]._name).to eq('Two')
351
346
  end
352
347
 
353
- it "should compare true" do
354
- a = Volt::Model.new({_name: 'Cool'})
348
+ it 'should compare true' do
349
+ a = Volt::Model.new(_name: 'Cool')
355
350
  expect(a == a).to eq(true)
356
351
  end
357
352
 
358
- it "should do index" do
359
- a = [{name: 'One'}, {name: 'Two'}, {name: 'Three'}]
353
+ it 'should do index' do
354
+ a = [{ name: 'One' }, { name: 'Two' }, { name: 'Three' }]
360
355
  expect(a.index(a[1])).to eq(1)
361
356
  end
362
357
 
363
- it "should convert to a hash, and unwrap all of the way down" do
358
+ it 'should convert to a hash, and unwrap all of the way down' do
364
359
  a = Volt::Model.new
365
- a._items << {name: 'Test1', other: {time: 'Now'}}
366
- a._items << {name: 'Test2', other: {time: 'Later'}}
360
+ a._items << { name: 'Test1', other: { time: 'Now' } }
361
+ a._items << { name: 'Test2', other: { time: 'Later' } }
367
362
 
368
363
  item1 = a._items[0].to_h
369
364
  expect(item1[:name]).to eq('Test1')
@@ -372,35 +367,34 @@ describe Volt::Model do
372
367
  all_items = a._items.to_a
373
368
 
374
369
  a = [
375
- {:name => "Test1", :other => {:time => "Now"}},
376
- {:name => "Test2", :other => {:time => "Later"}}
370
+ { name: 'Test1', other: { time: 'Now' } },
371
+ { name: 'Test2', other: { time: 'Later' } }
377
372
  ]
378
373
  expect(all_items).to eq(a)
379
374
  end
380
375
 
381
-
382
- describe "model paths" do
376
+ describe 'model paths' do
383
377
  before do
384
378
  @model = Volt::Model.new
385
379
  end
386
380
 
387
- it "should set the model path" do
381
+ it 'should set the model path' do
388
382
  @model._object._name = 'Test'
389
383
  expect(@model._object.path).to eq([:object])
390
384
  end
391
385
 
392
- it "should set the model path for a sub array" do
393
- @model._items << {_name: 'Bob'}
386
+ it 'should set the model path for a sub array' do
387
+ @model._items << { _name: 'Bob' }
394
388
  expect(@model._items.path).to eq([:items])
395
389
  expect(@model._items[0].path).to eq([:items, :[]])
396
390
  end
397
391
 
398
- it "should set the model path for sub sub arrays" do
399
- @model._lists << {_name: 'List 1', _items: []}
392
+ it 'should set the model path for sub sub arrays' do
393
+ @model._lists << { _name: 'List 1', _items: [] }
400
394
  expect(@model._lists[0]._items.path).to eq([:lists, :[], :items])
401
395
  end
402
396
 
403
- it "should update the path when added from a model instance to a collection" do
397
+ it 'should update the path when added from a model instance to a collection' do
404
398
  test_item = TestItem.new
405
399
 
406
400
  @model._items << test_item
@@ -408,8 +402,8 @@ describe Volt::Model do
408
402
  end
409
403
  end
410
404
 
411
- describe "persistors" do
412
- it "should setup a new instance of the persistor with self" do
405
+ describe 'persistors' do
406
+ it 'should setup a new instance of the persistor with self' do
413
407
  persistor = double('volt/persistor')
414
408
  expect(persistor).to receive(:new)
415
409
  @model = Volt::Model.new(nil, persistor: persistor)
@@ -417,7 +411,7 @@ describe Volt::Model do
417
411
  end
418
412
 
419
413
  if RUBY_PLATFORM != 'opal'
420
- describe "class loading" do
414
+ describe 'class loading' do
421
415
  it 'should load classes for models' do
422
416
  $page = Volt::Page.new
423
417
  $page.add_model('Item')
@@ -428,7 +422,7 @@ describe Volt::Model do
428
422
  expect(@model._items.buffer.class).to eq(Item)
429
423
 
430
424
  # Should insert as the right type
431
- @model._items << {_name: 'Item 1'}
425
+ @model._items << { _name: 'Item 1' }
432
426
  expect(@model._items[0].class).to eq(Item)
433
427
  end
434
428
  end