volt 0.8.15 → 0.8.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile +1 -1
- data/Guardfile +2 -3
- data/Rakefile +1 -4
- data/VERSION +1 -1
- data/app/volt/controllers/notices_controller.rb +1 -1
- data/app/volt/tasks/live_query/data_store.rb +7 -7
- data/app/volt/tasks/live_query/live_query.rb +7 -9
- data/app/volt/tasks/live_query/live_query_pool.rb +13 -12
- data/app/volt/tasks/live_query/query_tracker.rb +4 -5
- data/app/volt/tasks/query_tasks.rb +9 -11
- data/app/volt/tasks/store_tasks.rb +4 -4
- data/app/volt/tasks/user_tasks.rb +1 -1
- data/bin/volt +2 -2
- data/lib/volt.rb +3 -7
- data/lib/volt/assets/test.rb +1 -2
- data/lib/volt/benchmark/benchmark.rb +3 -3
- data/lib/volt/boot.rb +1 -1
- data/lib/volt/cli.rb +18 -18
- data/lib/volt/cli/asset_compile.rb +8 -10
- data/lib/volt/cli/generate.rb +9 -11
- data/lib/volt/cli/new_gem.rb +51 -51
- data/lib/volt/config.rb +2 -3
- data/lib/volt/console.rb +1 -1
- data/lib/volt/controllers/model_controller.rb +6 -6
- data/lib/volt/data_stores/data_store.rb +1 -1
- data/lib/volt/data_stores/mongo_driver.rb +1 -1
- data/lib/volt/extra_core/array.rb +2 -2
- data/lib/volt/extra_core/blank.rb +1 -2
- data/lib/volt/extra_core/extra_core.rb +1 -1
- data/lib/volt/extra_core/inflector/methods.rb +0 -1
- data/lib/volt/extra_core/logger.rb +13 -7
- data/lib/volt/extra_core/numeric.rb +1 -1
- data/lib/volt/extra_core/string.rb +7 -7
- data/lib/volt/extra_core/stringify_keys.rb +5 -5
- data/lib/volt/models.rb +2 -2
- data/lib/volt/models/array_model.rb +18 -19
- data/lib/volt/models/cursor.rb +0 -1
- data/lib/volt/models/model.rb +17 -35
- data/lib/volt/models/model_hash_behaviour.rb +0 -2
- data/lib/volt/models/model_state.rb +1 -1
- data/lib/volt/models/model_wrapper.rb +1 -1
- data/lib/volt/models/persistors/array_store.rb +26 -13
- data/lib/volt/models/persistors/base.rb +1 -1
- data/lib/volt/models/persistors/flash.rb +2 -2
- data/lib/volt/models/persistors/local_store.rb +2 -3
- data/lib/volt/models/persistors/model_store.rb +7 -6
- data/lib/volt/models/persistors/params.rb +2 -2
- data/lib/volt/models/persistors/query/query_listener.rb +2 -0
- data/lib/volt/models/persistors/query/query_listener_pool.rb +1 -1
- data/lib/volt/models/persistors/store.rb +1 -2
- data/lib/volt/models/persistors/store_state.rb +2 -3
- data/lib/volt/models/url.rb +17 -16
- data/lib/volt/models/validations.rb +11 -14
- data/lib/volt/models/validators/length_validator.rb +3 -3
- data/lib/volt/models/validators/presence_validator.rb +2 -2
- data/lib/volt/page/bindings/attribute_binding.rb +2 -3
- data/lib/volt/page/bindings/base_binding.rb +1 -1
- data/lib/volt/page/bindings/each_binding.rb +8 -9
- data/lib/volt/page/bindings/event_binding.rb +2 -3
- data/lib/volt/page/bindings/template_binding.rb +8 -7
- data/lib/volt/page/bindings/template_binding/grouped_controllers.rb +2 -1
- data/lib/volt/page/channel.rb +10 -10
- data/lib/volt/page/channel_stub.rb +1 -1
- data/lib/volt/page/document.rb +0 -1
- data/lib/volt/page/document_events.rb +4 -4
- data/lib/volt/page/page.rb +26 -19
- data/lib/volt/page/string_template_renderer.rb +2 -2
- data/lib/volt/page/sub_context.rb +10 -4
- data/lib/volt/page/targets/attribute_section.rb +1 -1
- data/lib/volt/page/targets/attribute_target.rb +1 -2
- data/lib/volt/page/targets/base_section.rb +4 -4
- data/lib/volt/page/targets/binding_document/base_node.rb +0 -1
- data/lib/volt/page/targets/binding_document/component_node.rb +4 -5
- data/lib/volt/page/targets/dom_section.rb +21 -22
- data/lib/volt/page/targets/dom_target.rb +1 -1
- data/lib/volt/page/targets/dom_template.rb +11 -12
- data/lib/volt/page/targets/helpers/comment_searchers.rb +7 -8
- data/lib/volt/page/tasks.rb +0 -1
- data/lib/volt/page/template_renderer.rb +1 -1
- data/lib/volt/page/url_tracker.rb +3 -3
- data/lib/volt/reactive/computation.rb +5 -11
- data/lib/volt/reactive/dependency.rb +1 -3
- data/lib/volt/reactive/eventable.rb +17 -4
- data/lib/volt/reactive/hash_dependency.rb +1 -0
- data/lib/volt/reactive/reactive_accessors.rb +0 -1
- data/lib/volt/reactive/reactive_array.rb +20 -25
- data/lib/volt/reactive/reactive_hash.rb +3 -3
- data/lib/volt/router/routes.rb +11 -13
- data/lib/volt/server.rb +17 -17
- data/lib/volt/server/component_handler.rb +2 -2
- data/lib/volt/server/component_templates.rb +8 -8
- data/lib/volt/server/html_parser/attribute_scope.rb +9 -10
- data/lib/volt/server/html_parser/if_view_scope.rb +2 -2
- data/lib/volt/server/html_parser/sandlebars_parser.rb +14 -14
- data/lib/volt/server/html_parser/textarea_scope.rb +1 -2
- data/lib/volt/server/html_parser/view_handler.rb +1 -1
- data/lib/volt/server/html_parser/view_parser.rb +1 -1
- data/lib/volt/server/html_parser/view_scope.rb +10 -10
- data/lib/volt/server/rack/asset_files.rb +15 -16
- data/lib/volt/server/rack/component_code.rb +2 -2
- data/lib/volt/server/rack/component_html_renderer.rb +0 -1
- data/lib/volt/server/rack/component_paths.rb +13 -10
- data/lib/volt/server/rack/index_files.rb +4 -4
- data/lib/volt/server/rack/opal_files.rb +4 -5
- data/lib/volt/server/rack/source_map_server.rb +3 -3
- data/lib/volt/server/socket_connection_handler.rb +3 -4
- data/lib/volt/server/socket_connection_handler_stub.rb +1 -1
- data/lib/volt/spec/setup.rb +3 -3
- data/lib/volt/store/mongo.rb +2 -2
- data/lib/volt/tasks/task_handler.rb +3 -3
- data/lib/volt/utils/generic_counting_pool.rb +2 -2
- data/lib/volt/utils/generic_pool.rb +7 -8
- data/lib/volt/utils/local_storage.rb +4 -4
- data/lib/volt/volt/environment.rb +1 -1
- data/spec/apps/file_loading/app/shared/config/dependencies.rb +1 -1
- data/spec/apps/kitchen_sink/Gemfile +0 -2
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +5 -5
- data/spec/apps/kitchen_sink/app/main/controllers/main_controller.rb +7 -6
- data/spec/apps/kitchen_sink/app/main/controllers/todos_controller.rb +3 -4
- data/spec/controllers/reactive_accessors_spec.rb +4 -4
- data/spec/extra_core/inflector_spec.rb +1 -1
- data/spec/extra_core/string_transformation_test_cases.rb +23 -24
- data/spec/extra_core/string_transformations_spec.rb +11 -12
- data/spec/integration/bindings_spec.rb +15 -15
- data/spec/integration/list_spec.rb +12 -13
- data/spec/integration/templates_spec.rb +3 -3
- data/spec/models/model_spec.rb +74 -80
- data/spec/models/persistors/params_spec.rb +2 -2
- data/spec/models/persistors/store_spec.rb +4 -4
- data/spec/models/validations_spec.rb +14 -23
- data/spec/page/bindings/content_binding_spec.rb +7 -8
- data/spec/page/bindings/template_binding_spec.rb +22 -24
- data/spec/page/sub_context_spec.rb +2 -2
- data/spec/reactive/computation_spec.rb +3 -3
- data/spec/reactive/reactive_array_spec.rb +12 -12
- data/spec/router/routes_spec.rb +45 -48
- data/spec/server/html_parser/sandlebars_parser_spec.rb +42 -42
- data/spec/server/html_parser/view_parser_spec.rb +132 -153
- data/spec/server/rack/asset_files_spec.rb +9 -8
- data/spec/server/rack/component_paths_spec.rb +5 -5
- data/spec/server/rack/rack_requests_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- data/spec/tasks/live_query_spec.rb +4 -5
- data/spec/tasks/query_tasks.rb +2 -4
- data/spec/tasks/query_tracker_spec.rb +29 -29
- data/spec/templates/targets/binding_document/component_node_spec.rb +1 -1
- data/spec/utils/generic_counting_pool_spec.rb +4 -4
- data/spec/utils/generic_pool_spec.rb +12 -12
- data/templates/component/config/routes.rb +2 -2
- data/templates/component/controllers/main_controller.rb +7 -6
- data/templates/newgem/app/newgem/config/dependencies.rb +1 -1
- data/templates/newgem/app/newgem/config/routes.rb +1 -1
- data/templates/project/app/main/config/routes.rb +2 -2
- data/templates/project/app/main/controllers/main_controller.rb +7 -6
- data/templates/project/spec/sample_spec.rb +2 -2
- data/volt.gemspec +32 -33
- metadata +3 -4
- data/lib/volt/extra_core/log.rb +0 -56
- data/lib/volt/extra_core/try.rb +0 -31
@@ -1,25 +1,26 @@
|
|
1
1
|
if RUBY_PLATFORM != 'opal'
|
2
|
+
require 'spec_helper'
|
2
3
|
require 'volt/server/rack/asset_files'
|
3
4
|
|
4
5
|
describe Volt::AssetFiles do
|
5
6
|
before do
|
6
|
-
spec_app_root = File.join(File.dirname(__FILE__),
|
7
|
+
spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
|
7
8
|
|
8
|
-
path_to_main = File.join(File.dirname(__FILE__),
|
9
|
+
path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
|
9
10
|
@component_paths = Volt::ComponentPaths.new(spec_app_root)
|
10
11
|
end
|
11
12
|
|
12
|
-
it
|
13
|
-
main = Volt::AssetFiles.new(
|
13
|
+
it 'should return the dependencies list' do
|
14
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
14
15
|
|
15
16
|
components = main.components
|
16
|
-
expect(components).to eq(
|
17
|
+
expect(components).to eq(%w(volt main shared bootstrap slideshow))
|
17
18
|
end
|
18
19
|
|
19
|
-
it
|
20
|
-
main = Volt::AssetFiles.new(
|
20
|
+
it 'should list all JS files' do
|
21
|
+
main = Volt::AssetFiles.new('main', @component_paths)
|
21
22
|
|
22
|
-
expect(main.javascript_files(nil)).to eq([
|
23
|
+
expect(main.javascript_files(nil)).to eq(['/assets/js/jquery-2.0.3.js', '/assets/js/setImmediate.js', '/assets/js/sockjs-0.3.4.min.js', '/assets/js/bootstrap.js', '/assets/js/test2.js', '/assets/js/test3.js', '/assets/js/test1.js', '/assets/volt/page/page.js', '/components/main.js'])
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -3,13 +3,13 @@ if RUBY_PLATFORM != 'opal'
|
|
3
3
|
|
4
4
|
describe Volt::ComponentPaths do
|
5
5
|
before do
|
6
|
-
spec_app_root = File.join(File.dirname(__FILE__),
|
6
|
+
spec_app_root = File.join(File.dirname(__FILE__), '../../apps/file_loading')
|
7
7
|
|
8
|
-
path_to_main = File.join(File.dirname(__FILE__),
|
8
|
+
path_to_main = File.join(File.dirname(__FILE__), '../../apps/file_loading/app/main')
|
9
9
|
@component_paths = Volt::ComponentPaths.new(spec_app_root)
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
12
|
+
it 'should return the paths to all app folders' do
|
13
13
|
match_count = 0
|
14
14
|
@component_paths.app_folders do |app_folder|
|
15
15
|
if app_folder[/spec\/apps\/file_loading\/app$/] || app_folder[/spec\/apps\/file_loading\/vendor\/app$/]
|
@@ -20,8 +20,8 @@ if RUBY_PLATFORM != 'opal'
|
|
20
20
|
expect(match_count).to eq(2)
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
main_path = @component_paths.
|
23
|
+
it 'should return the path to a component' do
|
24
|
+
main_path = @component_paths.component_paths('main').first
|
25
25
|
expect(main_path).to match(/spec\/apps\/file_loading\/app\/main$/)
|
26
26
|
end
|
27
27
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
if ENV['BROWSER'] && ENV['BROWSER'] == 'phantom'
|
3
3
|
describe 'Rack Requests', type: :feature do
|
4
|
-
it
|
4
|
+
it 'should send JS file with JS mimetype' do
|
5
5
|
visit '/components/main.js'
|
6
6
|
|
7
|
-
expect(
|
7
|
+
expect(page.response_headers['Content-Type']).to include 'application/javascript'
|
8
8
|
end
|
9
9
|
end
|
10
|
-
end
|
10
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@ require 'volt/spec/setup'
|
|
3
3
|
if RUBY_PLATFORM == 'opal'
|
4
4
|
else
|
5
5
|
# Specs are run against the kitchen sink app
|
6
|
-
kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
+
kitchen_sink_path = File.expand_path(File.join(File.dirname(__FILE__), 'apps/kitchen_sink'))
|
7
7
|
Volt.spec_setup(kitchen_sink_path)
|
8
8
|
end
|
9
9
|
|
@@ -1,20 +1,19 @@
|
|
1
1
|
if RUBY_PLATFORM != 'opal'
|
2
|
-
describe
|
2
|
+
describe 'LiveQuery' do
|
3
3
|
before do
|
4
|
-
load File.join(File.dirname(__FILE__),
|
4
|
+
load File.join(File.dirname(__FILE__), '../../app/volt/tasks/live_query/live_query.rb')
|
5
5
|
end
|
6
6
|
|
7
|
-
it
|
7
|
+
it 'should run a query' do
|
8
8
|
pool = double('volt/pool')
|
9
9
|
data_store = double('volt/data store')
|
10
10
|
|
11
11
|
expect(data_store).to receive(:query).with('_items', {}).and_return([
|
12
|
-
{'_id' => 0, '_name' => 'one'}
|
12
|
+
{ '_id' => 0, '_name' => 'one' }
|
13
13
|
])
|
14
14
|
|
15
15
|
live_query = LiveQuery.new(pool, data_store, '_items', {})
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
18
|
end
|
20
19
|
end
|
data/spec/tasks/query_tasks.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
if RUBY_PLATFORM != 'opal'
|
2
|
-
describe
|
2
|
+
describe 'Volt::QueryTasks' do
|
3
3
|
before do
|
4
|
-
load File.join(File.dirname(__FILE__),
|
4
|
+
load File.join(File.dirname(__FILE__), '../../app/volt/tasks/query_tasks.rb')
|
5
5
|
end
|
6
6
|
|
7
|
-
|
8
|
-
|
9
7
|
end
|
10
8
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if RUBY_PLATFORM != 'opal'
|
2
|
-
describe
|
2
|
+
describe 'LiveQuery' do
|
3
3
|
before do
|
4
|
-
load File.join(File.dirname(__FILE__),
|
4
|
+
load File.join(File.dirname(__FILE__), '../../app/volt/tasks/live_query/live_query.rb')
|
5
5
|
end
|
6
6
|
|
7
7
|
# LiveQueryStub behaves as the front-end would with the changes to a
|
@@ -18,7 +18,7 @@ if RUBY_PLATFORM != 'opal'
|
|
18
18
|
|
19
19
|
def notify_removed(ids, skip_channel)
|
20
20
|
# Remove the id's that need to be removed
|
21
|
-
@items.reject! {|item| ids.include?(item['_id']) }
|
21
|
+
@items.reject! { |item| ids.include?(item['_id']) }
|
22
22
|
end
|
23
23
|
|
24
24
|
def notify_added(index, data, skip_channel)
|
@@ -26,7 +26,7 @@ if RUBY_PLATFORM != 'opal'
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def notify_moved(id, index, skip_channel)
|
29
|
-
item = @items.find {|item| item['_id'] == id }
|
29
|
+
item = @items.find { |item| item['_id'] == id }
|
30
30
|
@items.delete(item)
|
31
31
|
|
32
32
|
@items.insert(index, item)
|
@@ -47,9 +47,9 @@ if RUBY_PLATFORM != 'opal'
|
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it 'should add items' do
|
51
51
|
@items = [
|
52
|
-
{'_id' => 1, '_name' => 'one'}
|
52
|
+
{ '_id' => 1, '_name' => 'one' }
|
53
53
|
]
|
54
54
|
|
55
55
|
expect(@live_query.items).to eq([])
|
@@ -59,57 +59,57 @@ if RUBY_PLATFORM != 'opal'
|
|
59
59
|
expect(@live_query.items).to eq(@items)
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
62
|
+
it 'should remove items' do
|
63
63
|
@items = [
|
64
|
-
{'_id' => 1, '_name' => 'one'},
|
65
|
-
{'_id' => 2, '_name' => 'two'}
|
64
|
+
{ '_id' => 1, '_name' => 'one' },
|
65
|
+
{ '_id' => 2, '_name' => 'two' }
|
66
66
|
]
|
67
67
|
@query_tracker.run
|
68
68
|
expect(@live_query.items).to eq(@items)
|
69
69
|
|
70
70
|
@items = [
|
71
|
-
{'_id' => 2, '_name' => 'two'}
|
71
|
+
{ '_id' => 2, '_name' => 'two' }
|
72
72
|
]
|
73
73
|
@query_tracker.run
|
74
74
|
expect(@live_query.items).to eq(@items)
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
77
|
+
it 'should move items' do
|
78
78
|
@items = [
|
79
|
-
{'_id' => 1, '_name' => 'one'},
|
80
|
-
{'_id' => 2, '_name' => 'two'},
|
81
|
-
{'_id' => 3, '_name' => 'three'}
|
79
|
+
{ '_id' => 1, '_name' => 'one' },
|
80
|
+
{ '_id' => 2, '_name' => 'two' },
|
81
|
+
{ '_id' => 3, '_name' => 'three' }
|
82
82
|
]
|
83
83
|
@query_tracker.run
|
84
84
|
expect(@live_query.items).to eq(@items)
|
85
85
|
|
86
86
|
@items = [
|
87
|
-
{'_id' => 2, '_name' => 'two'},
|
88
|
-
{'_id' => 3, '_name' => 'three'},
|
89
|
-
{'_id' => 1, '_name' => 'one'}
|
87
|
+
{ '_id' => 2, '_name' => 'two' },
|
88
|
+
{ '_id' => 3, '_name' => 'three' },
|
89
|
+
{ '_id' => 1, '_name' => 'one' }
|
90
90
|
]
|
91
91
|
@query_tracker.run
|
92
92
|
expect(@live_query.items).to eq(@items)
|
93
93
|
end
|
94
94
|
|
95
|
-
it
|
95
|
+
it 'should handle complex transforms' do
|
96
96
|
@items = [
|
97
|
-
{'_id' => 1, '_name' => 'one'},
|
98
|
-
{'_id' => 2, '_name' => 'two'},
|
99
|
-
{'_id' => 3, '_name' => 'three'},
|
100
|
-
{'_id' => 4, '_name' => 'four'},
|
101
|
-
{'_id' => 5, '_name' => 'five'}
|
97
|
+
{ '_id' => 1, '_name' => 'one' },
|
98
|
+
{ '_id' => 2, '_name' => 'two' },
|
99
|
+
{ '_id' => 3, '_name' => 'three' },
|
100
|
+
{ '_id' => 4, '_name' => 'four' },
|
101
|
+
{ '_id' => 5, '_name' => 'five' }
|
102
102
|
]
|
103
103
|
@query_tracker.run
|
104
104
|
expect(@live_query.items).to eq(@items)
|
105
105
|
|
106
106
|
@items = [
|
107
|
-
{'_id' => 7, '_name' => 'seven'},
|
108
|
-
{'_id' => 4, '_name' => 'four'},
|
109
|
-
{'_id' => 1, '_name' => 'one'},
|
110
|
-
{'_id' => 5, '_name' => 'five'},
|
111
|
-
{'_id' => 3, '_name' => 'three'},
|
112
|
-
{'_id' => 6, '_name' => 'five'}
|
107
|
+
{ '_id' => 7, '_name' => 'seven' },
|
108
|
+
{ '_id' => 4, '_name' => 'four' },
|
109
|
+
{ '_id' => 1, '_name' => 'one' },
|
110
|
+
{ '_id' => 5, '_name' => 'five' },
|
111
|
+
{ '_id' => 3, '_name' => 'three' },
|
112
|
+
{ '_id' => 6, '_name' => 'five' }
|
113
113
|
]
|
114
114
|
@query_tracker.run
|
115
115
|
expect(@live_query.items).to eq(@items)
|
@@ -10,7 +10,7 @@ describe Volt::ComponentNode do
|
|
10
10
|
@component.html = html
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it 'should find a component from a binding id' do
|
14
14
|
expect(@component.find_by_binding_id(1).to_html).to eq('Inside')
|
15
15
|
expect(@component.find_by_binding_id(0).to_html).to eq('Before Inside After')
|
16
16
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'volt/utils/generic_counting_pool'
|
2
2
|
|
3
3
|
class CountingPoolTest < Volt::GenericCountingPool
|
4
|
-
def create(id, name=nil)
|
5
|
-
|
4
|
+
def create(id, name = nil)
|
5
|
+
Object.new
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -11,7 +11,7 @@ describe Volt::GenericCountingPool do
|
|
11
11
|
@count_pool = CountingPoolTest.new
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'should lookup and retrieve' do
|
15
15
|
item1 = @count_pool.find('one')
|
16
16
|
|
17
17
|
item2 = @count_pool.find('one')
|
@@ -21,7 +21,7 @@ describe Volt::GenericCountingPool do
|
|
21
21
|
expect(item2).to_not eq(item3)
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
24
|
+
it 'should only remove items when the same number have been removed as have been added' do
|
25
25
|
item1 = @count_pool.find('_items', 'one')
|
26
26
|
item2 = @count_pool.find('_items', 'one')
|
27
27
|
expect(@count_pool.instance_variable_get('@pool')).to_not eq({})
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'volt/utils/generic_pool'
|
2
2
|
|
3
3
|
class PoolTest < Volt::GenericPool
|
4
|
-
def create(collection, query, other=nil)
|
5
|
-
|
4
|
+
def create(collection, query, other = nil)
|
5
|
+
Object.new
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -12,18 +12,18 @@ describe Volt::GenericPool do
|
|
12
12
|
@pool_test = PoolTest.new
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'should insert nested for fast lookup at a path' do
|
16
16
|
item1 = @pool_test.lookup('_items', 'one')
|
17
|
-
expect(@pool_test.instance_variable_get('@pool')).to eq(
|
17
|
+
expect(@pool_test.instance_variable_get('@pool')).to eq('_items' => { 'one' => item1 })
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'should retrieve the same item both times' do
|
21
21
|
item1 = @pool_test.lookup('_items', {})
|
22
22
|
item2 = @pool_test.lookup('_items', {})
|
23
23
|
expect(item1.object_id).to eq(item2.object_id)
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
26
|
+
it 'should recreate after being removed' do
|
27
27
|
item1 = @pool_test.lookup('_items', {})
|
28
28
|
item2 = @pool_test.lookup('_items', {})
|
29
29
|
expect(item1.object_id).to eq(item2.object_id)
|
@@ -33,17 +33,17 @@ describe Volt::GenericPool do
|
|
33
33
|
expect(item3.object_id).to_not eq(item2.object_id)
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
37
|
-
@pool_test.instance_variable_set('@pool',
|
36
|
+
it 'should remove all of the way down' do
|
37
|
+
@pool_test.instance_variable_set('@pool', name: { ok: true }, yep: true)
|
38
38
|
|
39
39
|
@pool_test.remove(:name, :ok)
|
40
40
|
|
41
|
-
expect(@pool_test.instance_variable_get('@pool')).to eq(
|
41
|
+
expect(@pool_test.instance_variable_get('@pool')).to eq(yep: true)
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
45
|
-
item1 = @pool_test.lookup('_items', '_some',
|
46
|
-
item2 = @pool_test.lookup('_items', '_some',
|
44
|
+
it 'should lookup all items at a path' do
|
45
|
+
item1 = @pool_test.lookup('_items', '_some', name: 'bob')
|
46
|
+
item2 = @pool_test.lookup('_items', '_some', name: 'jim')
|
47
47
|
|
48
48
|
expect(@pool_test.lookup_all('_items', '_some')).to eq([item1, item2])
|
49
49
|
end
|
@@ -8,10 +8,11 @@ class MainController < Volt::ModelController
|
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
|
12
|
+
# the main template contains a #template binding that shows another
|
13
|
+
# template. This is the path to that template. It may change based
|
14
|
+
# on the params._controller and params._action values.
|
15
|
+
def main_path
|
16
|
+
params._controller.or('main') + '/' + params._action.or('index')
|
17
|
+
end
|
17
18
|
end
|
@@ -1 +1 @@
|
|
1
|
-
# Component dependencies
|
1
|
+
# Component dependencies
|
@@ -1 +1 @@
|
|
1
|
-
# Component routes
|
1
|
+
# Component routes
|
@@ -8,10 +8,11 @@ class MainController < Volt::ModelController
|
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
|
12
|
+
# the main template contains a #template binding that shows another
|
13
|
+
# template. This is the path to that template. It may change based
|
14
|
+
# on the params._controller and params._action values.
|
15
|
+
def main_path
|
16
|
+
params._controller.or('main') + '/' + params._action.or('index')
|
17
|
+
end
|
17
18
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
if ENV['BROWSER']
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe
|
5
|
-
it
|
4
|
+
describe 'sample integration test', type: :feature do
|
5
|
+
it 'should load the page' do
|
6
6
|
visit '/'
|
7
7
|
|
8
8
|
expect(page).to have_content('Home')
|
data/volt.gemspec
CHANGED
@@ -5,50 +5,49 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
version = File.read(File.expand_path('../VERSION', __FILE__)).strip
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = 'volt'
|
9
9
|
spec.version = version
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
12
|
-
spec.summary =
|
10
|
+
spec.authors = ['Ryan Stout']
|
11
|
+
spec.email = ['ryan@agileproductions.com']
|
12
|
+
spec.summary = 'A ruby web framework where your ruby runs on both server and client (via Opal)'
|
13
13
|
# spec.description = %q{}
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.homepage = 'http://voltframework.com'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
|
-
spec.files = `git ls-files`.split(
|
17
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
21
|
-
|
22
|
-
spec.add_dependency
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'thor', '~> 0.19.0'
|
23
|
+
spec.add_dependency 'pry', '~> 0.9.12.0'
|
24
|
+
spec.add_dependency 'rack', '~> 1.5.0'
|
25
|
+
spec.add_dependency 'sprockets-sass', '~> 1.0.0'
|
26
|
+
spec.add_dependency 'sass', '~> 3.2.5'
|
27
|
+
spec.add_dependency 'mongo', '~> 1.9.0'
|
28
28
|
# spec.add_dependency "bson_ext", "~> 1.9.0"
|
29
29
|
# spec.add_dependency "thin", "~> 1.6.0"
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
32
|
-
spec.add_dependency
|
33
|
-
spec.add_dependency
|
34
|
-
spec.add_dependency
|
35
|
-
spec.add_dependency
|
36
|
-
spec.add_dependency
|
37
|
-
spec.add_dependency
|
38
|
-
spec.add_dependency
|
39
|
-
spec.add_dependency
|
40
|
-
spec.add_dependency
|
41
|
-
spec.add_dependency
|
42
|
-
spec.add_dependency
|
43
|
-
spec.add_dependency
|
44
|
-
|
30
|
+
spec.add_dependency 'rake', '~> 10.0.4'
|
31
|
+
spec.add_dependency 'listen', '~> 2.7.0'
|
32
|
+
spec.add_dependency 'uglifier', '~> 2.4.0'
|
33
|
+
spec.add_dependency 'yui-compressor', '~> 0.12.0'
|
34
|
+
spec.add_dependency 'opal', '~> 0.6.0'
|
35
|
+
spec.add_dependency 'opal-jquery', '~> 0.2.0'
|
36
|
+
spec.add_dependency 'rspec-core', '~> 3.1.0'
|
37
|
+
spec.add_dependency 'rspec-expectations', '~> 3.1.0'
|
38
|
+
spec.add_dependency 'capybara', '~> 2.4.2'
|
39
|
+
spec.add_dependency 'selenium-webdriver', '~> 2.43.0'
|
40
|
+
spec.add_dependency 'chromedriver2-helper', '~> 0.0.8'
|
41
|
+
spec.add_dependency 'poltergeist', '~> 1.5.0'
|
42
|
+
spec.add_dependency 'opal-rspec', '0.3.0.beta3'
|
43
|
+
spec.add_dependency 'bundler', '>= 1.5'
|
45
44
|
|
46
45
|
# spec.add_dependency "promise.rb", "~> 0.6.1"
|
47
46
|
|
48
47
|
# spec.add_dependency "rack-colorized_logger", "~> 1.0.4"
|
49
48
|
|
50
|
-
spec.add_development_dependency
|
51
|
-
spec.add_development_dependency
|
52
|
-
spec.add_development_dependency
|
49
|
+
spec.add_development_dependency 'guard', '2.6.0' # bug in current guard
|
50
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.3.0'
|
51
|
+
spec.add_development_dependency 'yard', '~> 0.8.7.0'
|
53
52
|
|
54
53
|
end
|