volt 0.9.0.pre3 → 0.9.0.pre4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -7
- data/VERSION +1 -1
- data/app/volt/tasks/user_tasks.rb +7 -2
- data/lib/volt.rb +1 -0
- data/lib/volt/cli/generate.rb +28 -10
- data/lib/volt/controllers/http_controller.rb +1 -1
- data/lib/volt/extra_core/logger.rb +14 -11
- data/lib/volt/models/persistors/query/query_listener.rb +7 -1
- data/lib/volt/page/bindings/component_binding.rb +2 -2
- data/lib/volt/page/bindings/{template_binding.rb → view_binding.rb} +3 -3
- data/lib/volt/page/bindings/{template_binding → view_binding}/grouped_controllers.rb +0 -0
- data/lib/volt/page/bindings/{template_binding → view_binding}/view_lookup_for_path.rb +0 -0
- data/lib/volt/page/page.rb +1 -1
- data/lib/volt/server/html_parser/view_scope.rb +4 -1
- data/lib/volt/server/rack/component_paths.rb +1 -1
- data/lib/volt/spec/setup.rb +10 -2
- data/lib/volt/tasks/dispatcher.rb +10 -3
- data/lib/volt/utils/logging/task_argument_filterer.rb +42 -0
- data/lib/volt/utils/logging/task_logger.rb +14 -0
- data/lib/volt/utils/volt_user_error.rb +4 -0
- data/lib/volt/volt/users.rb +2 -2
- data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
- data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +1 -1
- data/spec/apps/kitchen_sink/app/main/views/main/first_last.html +13 -0
- data/spec/apps/kitchen_sink/app/main/views/main/main.html +2 -2
- data/spec/controllers/http_controller_spec.rb +2 -2
- data/spec/integration/bindings_spec.rb +154 -156
- data/spec/integration/cookies_spec.rb +28 -30
- data/spec/integration/first_last_spec.rb +14 -0
- data/spec/integration/http_endpoints_spec.rb +22 -24
- data/spec/integration/templates_spec.rb +7 -9
- data/spec/integration/user_spec.rb +49 -52
- data/spec/integration/yield_spec.rb +12 -14
- data/spec/page/bindings/template_binding/view_lookup_for_path_spec.rb +2 -2
- data/spec/server/html_parser/view_parser_spec.rb +2 -2
- data/spec/server/rack/http_resource_spec.rb +2 -2
- data/spec/utils/task_argument_filtererer_spec.rb +17 -0
- data/templates/component/config/routes.rb +0 -5
- data/templates/component/controllers/server/.empty_directory +0 -0
- data/templates/component/lib/.empty_directory +0 -0
- data/templates/component_specs/controllers/server/.empty_directory +0 -0
- data/templates/component_specs/integration/.empty_directory +0 -0
- data/templates/component_specs/models/.empty_directory +0 -0
- data/templates/component_specs/tasks/.empty_directory +0 -0
- data/templates/controller/http_controller.rb.tt +1 -1
- data/templates/controller/http_controller_spec.rb.tt +5 -0
- data/templates/controller/model_controller.rb.tt +1 -1
- data/templates/controller/model_controller_spec.rb.tt +5 -0
- data/templates/model/model.rb.tt +1 -1
- data/templates/model/model_spec.rb.tt +5 -0
- data/templates/newgem/app/newgem/controllers/server/.empty_directory +0 -0
- data/templates/newgem/app/newgem/lib/.empty_directory +0 -0
- data/templates/newgem/lib/newgem.rb.tt +1 -1
- data/templates/project/app/main/views/main/main.html.tt +2 -2
- data/templates/project/config/app.rb.tt +5 -0
- data/templates/project/spec/app/main/controllers/server/sample_http_controller_spec.rb +5 -0
- data/templates/project/spec/app/main/tasks/sample_task_spec.rb +5 -0
- data/templates/task/task.rb.tt +0 -1
- data/templates/task/task_spec.rb.tt +5 -0
- data/templates/view/index.html.tt +5 -0
- metadata +29 -6
- data/templates/view/view.rb.tt +0 -4
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'first, last', type: :feature, sauce: true do
|
4
|
+
# Currently failing, fixing
|
5
|
+
# it 'should render first with a number argument' do
|
6
|
+
# store._messages << {body: 'hey, sup?'}
|
7
|
+
# store._messages << {body: 'not much'}
|
8
|
+
# store._messages << {body: 'you?'}
|
9
|
+
# store._messages << {body: 'just being awesome?'}
|
10
|
+
# store._messages << {body: 'writing some specs'}
|
11
|
+
#
|
12
|
+
# visit '/first_last'
|
13
|
+
# end
|
14
|
+
end
|
@@ -1,29 +1,27 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
describe 'http endpoints', type: :feature, sauce: true do
|
4
|
+
it 'should show the page' do
|
5
|
+
visit '/simple_http'
|
6
|
+
expect(page).to have_content('this is just some text')
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
it 'should have access to the store' do
|
10
|
+
DataStore.new.drop_database
|
11
|
+
$page.store._simple_http_tests << { name: 'hello' }
|
12
|
+
visit '/simple_http/store'
|
13
|
+
expect(page).to have_content('You had me at hello')
|
14
|
+
DataStore.new.drop_database
|
15
|
+
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
17
|
+
it 'should upload and store a file' do
|
18
|
+
file = 'tmp/uploaded_file'
|
19
|
+
FileUtils.rm(file) if File.exist?(file)
|
20
|
+
visit '/upload'
|
21
|
+
attach_file('file', __FILE__)
|
22
|
+
find('#submit_file_upload').click
|
23
|
+
expect(page).to have_content('successfully uploaded')
|
24
|
+
expect(File.exist?(file)).to be(true)
|
25
|
+
FileUtils.rm(file) if File.exist?(file)
|
28
26
|
end
|
29
27
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
describe 'bindings test', type: :feature, sauce: true do
|
4
|
+
it 'should change the title when changing pages' do
|
5
|
+
visit '/'
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
expect(page).to have_title 'KitchenSink - KitchenSink'
|
8
|
+
click_link 'Bindings'
|
10
9
|
|
11
|
-
|
12
|
-
end
|
10
|
+
expect(page).to have_title 'Bindings - KitchenSink'
|
13
11
|
end
|
14
12
|
end
|
@@ -1,78 +1,75 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
describe 'user accounts', type: :feature, sauce: true do
|
4
|
+
before(:each) do
|
5
|
+
# Clear out db
|
6
|
+
DataStore.new.drop_database
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
after(:each) do
|
10
|
+
# Clear out db
|
11
|
+
DataStore.new.drop_database
|
12
|
+
end
|
14
13
|
|
15
|
-
|
16
|
-
|
14
|
+
it 'should create an account' do
|
15
|
+
visit '/'
|
17
16
|
|
18
|
-
|
17
|
+
# sleep 300
|
19
18
|
|
20
|
-
|
19
|
+
click_link 'Login'
|
21
20
|
|
22
|
-
|
21
|
+
click_link 'Signup here'
|
23
22
|
|
24
|
-
|
23
|
+
fields = all(:css, 'form .form-control')
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
fields[0].set('test@test.com')
|
26
|
+
fields[1].set('awes0mesEcRet')
|
27
|
+
fields[2].set('Test Account 9550')
|
29
28
|
|
30
|
-
|
29
|
+
click_button 'Signup'
|
31
30
|
|
32
|
-
|
33
|
-
|
31
|
+
expect(page).to have_content('Test Account 9550')
|
32
|
+
end
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
it 'should login and logout' do
|
35
|
+
visit '/'
|
37
36
|
|
38
|
-
|
39
|
-
|
37
|
+
# Add the user
|
38
|
+
store._users! << { email: 'test@test.com', password: 'awes0mesEcRet', name: 'Test Account 9550' }
|
40
39
|
|
41
|
-
|
40
|
+
click_link 'Login'
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
fields = all(:css, 'form .form-control')
|
43
|
+
fields[0].set('test@test.com')
|
44
|
+
fields[1].set('awes0mesEcRet')
|
45
|
+
click_button 'Login'
|
47
46
|
|
48
|
-
|
47
|
+
expect(page).to have_content('Test Account 9550')
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
# Click the logout link
|
50
|
+
click_link 'Test Account 9550'
|
51
|
+
click_link 'Logout'
|
53
52
|
|
54
|
-
|
55
|
-
|
53
|
+
expect(page).to_not have_content('Test Account 9550')
|
54
|
+
end
|
56
55
|
|
57
|
-
|
58
|
-
|
56
|
+
it 'should fail to create an account without a valid email and password' do
|
57
|
+
visit '/'
|
59
58
|
|
60
|
-
|
61
|
-
|
59
|
+
click_link 'Login'
|
60
|
+
click_link 'Signup here'
|
62
61
|
|
63
|
-
|
62
|
+
expect(page).to_not have_content('must be at least 8 characters')
|
64
63
|
|
65
|
-
|
64
|
+
fields = all(:css, 'form .form-control')
|
66
65
|
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
fields[0].set('test')
|
67
|
+
fields[1].set('awe')
|
68
|
+
fields[2].set('Tes')
|
70
69
|
|
71
|
-
|
72
|
-
|
70
|
+
# some capybara drivers don't trigger blur correctly
|
71
|
+
page.execute_script("$('.form-control').blur()")
|
73
72
|
|
74
|
-
|
75
|
-
end
|
73
|
+
expect(page).to have_content('must be at least 8 characters')
|
76
74
|
end
|
77
|
-
|
78
75
|
end
|
@@ -1,18 +1,16 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
describe 'yield binding', type: :feature, sauce: true do
|
4
|
+
before do
|
5
|
+
visit '/yield'
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
it 'should render the yielded content multiple times' do
|
9
|
+
expect(page).to have_content("My yielded content 1")
|
10
|
+
expect(page).to have_content("My yielded content 2")
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
13
|
+
it 'should render the content from the tag\'s controller when yielding' do
|
14
|
+
expect(page).to have_content('This is my content')
|
17
15
|
end
|
18
|
-
end
|
16
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'volt/page/bindings/
|
2
|
+
require 'volt/page/bindings/view_binding'
|
3
3
|
|
4
4
|
# Setup page stub
|
5
5
|
|
@@ -7,7 +7,7 @@ class Volt::Page
|
|
7
7
|
attr_accessor :templates
|
8
8
|
end
|
9
9
|
|
10
|
-
describe Volt::
|
10
|
+
describe Volt::ViewBinding do
|
11
11
|
before do
|
12
12
|
@page = double('volt/page')
|
13
13
|
expect(@page).to receive(:templates).at_least(1).times { @templates }
|
@@ -164,7 +164,7 @@ describe Volt::ViewParser do
|
|
164
164
|
|
165
165
|
it 'should parse a template' do
|
166
166
|
html = <<-END
|
167
|
-
{{
|
167
|
+
{{ view "/home/temp/path" }}
|
168
168
|
END
|
169
169
|
|
170
170
|
view = Volt::ViewParser.new(html, 'main/main/main')
|
@@ -173,7 +173,7 @@ describe Volt::ViewParser do
|
|
173
173
|
'html' => " <!-- $0 --><!-- $/0 -->\n",
|
174
174
|
'bindings' => {
|
175
175
|
0 => [
|
176
|
-
"lambda { |__p, __t, __c, __id| Volt::
|
176
|
+
"lambda { |__p, __t, __c, __id| Volt::ViewBinding.new(__p, __t, __c, __id, \"main/main/main/body\", Proc.new { [\"/home/temp/path\"] }) }"
|
177
177
|
]
|
178
178
|
}
|
179
179
|
})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if RUBY_PLATFORM != 'opal'
|
4
|
+
describe TaskArgumentFilterer do
|
5
|
+
it 'should filter arguments' do
|
6
|
+
filtered_args = TaskArgumentFilterer.new({login: 'jim@jim.com', password: 'some password no one should see'}).run
|
7
|
+
|
8
|
+
expect(filtered_args).to eq({:login=>"jim@jim.com", :password=>"[FILTERED]"})
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should filter in nested args' do
|
12
|
+
filtered_args = TaskArgumentFilterer.new([:login, {login: 'jim@jim.com', password: 'some password'}]).run
|
13
|
+
|
14
|
+
expect(filtered_args).to eq([:login, {:login=>"jim@jim.com", :password=>"[FILTERED]"}])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/templates/model/model.rb.tt
CHANGED
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%- config[:constant_array].each_with_index do |c,i| -%>
|
2
|
-
<%= ' '*i
|
2
|
+
<%= ' '*i %>module <%= c %>
|
3
3
|
<%- end -%>
|
4
4
|
<%= ' '*config[:constant_array].size %># Your code goes here...
|
5
5
|
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<:Title>
|
2
|
-
{{
|
2
|
+
{{ view main_path, "title", {controller_group: 'main'} }}
|
3
3
|
|
4
4
|
<:Body>
|
5
5
|
<div class="container">
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
<:volt:notices />
|
16
16
|
|
17
|
-
{{
|
17
|
+
{{ view main_path, 'body', {controller_group: 'main'} }}
|
18
18
|
|
19
19
|
<div class="footer">
|
20
20
|
<p>© Company {{ Time.now.year }}</p>
|
@@ -12,6 +12,11 @@ Volt.configure do |config|
|
|
12
12
|
#
|
13
13
|
config.app_secret = '<%= SecureRandom.urlsafe_base64(50) %>'
|
14
14
|
|
15
|
+
# Data updates from the client come in via Tasks. The task dispatcher logs all calls to tasks.
|
16
|
+
# By default hashes in the arguments can be filtered based on keys. So any hash with a key of
|
17
|
+
# password will be filtered. You can add more fields to filter below:
|
18
|
+
config.filter_keys = [:password]
|
19
|
+
|
15
20
|
# Database config all start with db_ and can be set either in the config
|
16
21
|
# file or with an environment variable (DB_NAME for example).
|
17
22
|
|
data/templates/task/task.rb.tt
CHANGED