volt 0.9.0.pre3 → 0.9.0.pre4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -7
  3. data/VERSION +1 -1
  4. data/app/volt/tasks/user_tasks.rb +7 -2
  5. data/lib/volt.rb +1 -0
  6. data/lib/volt/cli/generate.rb +28 -10
  7. data/lib/volt/controllers/http_controller.rb +1 -1
  8. data/lib/volt/extra_core/logger.rb +14 -11
  9. data/lib/volt/models/persistors/query/query_listener.rb +7 -1
  10. data/lib/volt/page/bindings/component_binding.rb +2 -2
  11. data/lib/volt/page/bindings/{template_binding.rb → view_binding.rb} +3 -3
  12. data/lib/volt/page/bindings/{template_binding → view_binding}/grouped_controllers.rb +0 -0
  13. data/lib/volt/page/bindings/{template_binding → view_binding}/view_lookup_for_path.rb +0 -0
  14. data/lib/volt/page/page.rb +1 -1
  15. data/lib/volt/server/html_parser/view_scope.rb +4 -1
  16. data/lib/volt/server/rack/component_paths.rb +1 -1
  17. data/lib/volt/spec/setup.rb +10 -2
  18. data/lib/volt/tasks/dispatcher.rb +10 -3
  19. data/lib/volt/utils/logging/task_argument_filterer.rb +42 -0
  20. data/lib/volt/utils/logging/task_logger.rb +14 -0
  21. data/lib/volt/utils/volt_user_error.rb +4 -0
  22. data/lib/volt/volt/users.rb +2 -2
  23. data/spec/apps/kitchen_sink/app/main/config/routes.rb +1 -0
  24. data/spec/apps/kitchen_sink/app/main/controllers/server/simple_http_controller.rb +1 -1
  25. data/spec/apps/kitchen_sink/app/main/views/main/first_last.html +13 -0
  26. data/spec/apps/kitchen_sink/app/main/views/main/main.html +2 -2
  27. data/spec/controllers/http_controller_spec.rb +2 -2
  28. data/spec/integration/bindings_spec.rb +154 -156
  29. data/spec/integration/cookies_spec.rb +28 -30
  30. data/spec/integration/first_last_spec.rb +14 -0
  31. data/spec/integration/http_endpoints_spec.rb +22 -24
  32. data/spec/integration/templates_spec.rb +7 -9
  33. data/spec/integration/user_spec.rb +49 -52
  34. data/spec/integration/yield_spec.rb +12 -14
  35. data/spec/page/bindings/template_binding/view_lookup_for_path_spec.rb +2 -2
  36. data/spec/server/html_parser/view_parser_spec.rb +2 -2
  37. data/spec/server/rack/http_resource_spec.rb +2 -2
  38. data/spec/utils/task_argument_filtererer_spec.rb +17 -0
  39. data/templates/component/config/routes.rb +0 -5
  40. data/templates/component/controllers/server/.empty_directory +0 -0
  41. data/templates/component/lib/.empty_directory +0 -0
  42. data/templates/component_specs/controllers/server/.empty_directory +0 -0
  43. data/templates/component_specs/integration/.empty_directory +0 -0
  44. data/templates/component_specs/models/.empty_directory +0 -0
  45. data/templates/component_specs/tasks/.empty_directory +0 -0
  46. data/templates/controller/http_controller.rb.tt +1 -1
  47. data/templates/controller/http_controller_spec.rb.tt +5 -0
  48. data/templates/controller/model_controller.rb.tt +1 -1
  49. data/templates/controller/model_controller_spec.rb.tt +5 -0
  50. data/templates/model/model.rb.tt +1 -1
  51. data/templates/model/model_spec.rb.tt +5 -0
  52. data/templates/newgem/app/newgem/controllers/server/.empty_directory +0 -0
  53. data/templates/newgem/app/newgem/lib/.empty_directory +0 -0
  54. data/templates/newgem/lib/newgem.rb.tt +1 -1
  55. data/templates/project/app/main/views/main/main.html.tt +2 -2
  56. data/templates/project/config/app.rb.tt +5 -0
  57. data/templates/project/spec/app/main/controllers/server/sample_http_controller_spec.rb +5 -0
  58. data/templates/project/spec/app/main/tasks/sample_task_spec.rb +5 -0
  59. data/templates/task/task.rb.tt +0 -1
  60. data/templates/task/task_spec.rb.tt +5 -0
  61. data/templates/view/index.html.tt +5 -0
  62. metadata +29 -6
  63. data/templates/view/view.rb.tt +0 -4
@@ -0,0 +1,4 @@
1
+ # VoltUserError is a base class for Volt errors that you don't need backtraces on.
2
+ # These are errors that you simply need to communicate something to developer with.
3
+ class VoltUserError < RuntimeError
4
+ end
@@ -24,7 +24,7 @@ module Volt
24
24
  # TODO: We could cache the digest generation for even faster comparisons
25
25
  if hash != Digest::SHA256.hexdigest("#{Volt.config.app_secret}::#{user_id}")
26
26
  # user id has been tampered with, reject
27
- fail 'user id or hash has been tampered with'
27
+ fail VoltUserError, 'user id or hash is incorrectly signed. It may have been tampered with, the app secret changed, or generated in a different app.'
28
28
  end
29
29
 
30
30
  end
@@ -80,7 +80,7 @@ module Volt
80
80
 
81
81
  # Login the user, return a promise for success
82
82
  def login(username, password)
83
- UserTasks.login(username, password).then do |result|
83
+ UserTasks.login({login: username, password: password}).then do |result|
84
84
  # Assign the user_id cookie for the user
85
85
  $page.cookies._user_id = result
86
86
 
@@ -6,6 +6,7 @@ client '/store', action: 'store'
6
6
  client '/cookie_test', action: 'cookie_test'
7
7
  client '/flash', action: 'flash'
8
8
  client '/yield', action: 'yield'
9
+ client '/first_last', action: 'first_last'
9
10
  client '/todos', controller: 'todos'
10
11
 
11
12
  # Signup/login routes
@@ -9,7 +9,7 @@ module Main
9
9
  end
10
10
 
11
11
  def upload
12
- uploaded = params[:file][:tempfile]
12
+ uploaded = params._file._tempfile
13
13
  File.open('tmp/uploaded_file', 'wb') { |f| f.write(uploaded.read) }
14
14
  render text: 'Thanks for uploading'
15
15
  end
@@ -0,0 +1,13 @@
1
+ <:Title>
2
+ Last
3
+
4
+ <:Body>
5
+ <h1>First Last Test</h1>
6
+
7
+ {{ store._messages.first.inspect }}
8
+
9
+ ---
10
+
11
+ {{ store._messages.each do |message| }}
12
+ <p>{{ message._body }}</p>
13
+ {{ end }}
@@ -1,5 +1,5 @@
1
1
  <:Title>
2
- {{ template main_path, 'title', {controller_group: 'main'} }} - KitchenSink
2
+ {{ view main_path, 'title', {controller_group: 'main'} }} - KitchenSink
3
3
 
4
4
  <:Body>
5
5
  <div class="container">
@@ -19,7 +19,7 @@
19
19
 
20
20
  <:volt:notices />
21
21
 
22
- {{ template main_path, 'body', {controller_group: 'main'} }}
22
+ {{ view main_path, 'body', {controller_group: 'main'} }}
23
23
 
24
24
  <div class="footer">
25
25
  <p>&copy; Company {{ Time.now.year }}</p>
@@ -61,8 +61,8 @@ if RUBY_PLATFORM != 'opal'
61
61
  controller = TestHttpController.new(
62
62
  { another: 'params', 'and_a' => 'string' }, request)
63
63
  expect(controller.params.size).to eq(4)
64
- expect(controller.params[:and_a]).to eq('string')
65
- expect(controller.params[:this]).to eq('is_a')
64
+ expect(controller.params._and_a).to eq('string')
65
+ expect(controller.params._this).to eq('is_a')
66
66
  end
67
67
 
68
68
  it 'should perform the correct action' do
@@ -1,206 +1,204 @@
1
- if ENV['BROWSER']
2
- require 'spec_helper'
1
+ require 'spec_helper'
3
2
 
4
- describe 'bindings test', type: :feature, sauce: true do
5
- it 'should load the page' do
6
- visit '/'
3
+ describe 'bindings test', type: :feature, sauce: true do
4
+ it 'should load the page' do
5
+ visit '/'
7
6
 
8
- expect(page).to have_content('Kitchen Sink')
9
- end
7
+ expect(page).to have_content('Kitchen Sink')
8
+ end
10
9
 
11
- describe 'text/fields' do
12
- it 'should load the bindings page and update bindings' do
13
- visit '/'
10
+ describe 'text/fields' do
11
+ it 'should load the bindings page and update bindings' do
12
+ visit '/'
14
13
 
15
- click_link 'Bindings'
14
+ click_link 'Bindings'
16
15
 
17
- # Fill in one field and see if it updates the rest
18
- fill_in('pageName1', with: 'Page bindings')
19
- expect(find('#pageName1').value).to eq('Page bindings')
20
- expect(find('#pageName2').value).to eq('Page bindings')
21
- expect(find('#pageName3')).to have_content('Page bindings')
16
+ # Fill in one field and see if it updates the rest
17
+ fill_in('pageName1', with: 'Page bindings')
18
+ expect(find('#pageName1').value).to eq('Page bindings')
19
+ expect(find('#pageName2').value).to eq('Page bindings')
20
+ expect(find('#pageName3')).to have_content('Page bindings')
22
21
 
23
- fill_in('pageName2', with: 'Update everywhere')
24
- expect(find('#pageName1').value).to eq('Update everywhere')
25
- expect(find('#pageName2').value).to eq('Update everywhere')
26
- expect(find('#pageName3')).to have_content('Update everywhere')
27
- end
22
+ fill_in('pageName2', with: 'Update everywhere')
23
+ expect(find('#pageName1').value).to eq('Update everywhere')
24
+ expect(find('#pageName2').value).to eq('Update everywhere')
25
+ expect(find('#pageName3')).to have_content('Update everywhere')
26
+ end
28
27
 
29
- it 'should update params bindings and the url' do
30
- visit '/'
28
+ it 'should update params bindings and the url' do
29
+ visit '/'
31
30
 
32
- click_link 'Bindings'
31
+ click_link 'Bindings'
33
32
 
34
- # phantom does not support the html5 history api
35
- # TODO: We could probably polyfill this in phantom
36
- if ENV['BROWSER'] != 'phantom'
37
- expect(current_path).to eq('/bindings')
38
- end
33
+ # phantom does not support the html5 history api
34
+ # TODO: We could probably polyfill this in phantom
35
+ if ENV['BROWSER'] != 'phantom'
36
+ expect(current_path).to eq('/bindings')
37
+ end
39
38
 
40
- # Fill in one field and see if it updates the rest
41
- fill_in('paramsName1', with: 'Params bindings')
42
- expect(find('#paramsName1').value).to eq('Params bindings')
43
- expect(find('#paramsName2').value).to eq('Params bindings')
44
- expect(find('#paramsName3')).to have_content('Params bindings')
39
+ # Fill in one field and see if it updates the rest
40
+ fill_in('paramsName1', with: 'Params bindings')
41
+ expect(find('#paramsName1').value).to eq('Params bindings')
42
+ expect(find('#paramsName2').value).to eq('Params bindings')
43
+ expect(find('#paramsName3')).to have_content('Params bindings')
45
44
 
46
- fill_in('paramsName2', with: 'Update everywhere')
47
- expect(find('#paramsName1').value).to eq('Update everywhere')
48
- expect(find('#paramsName2').value).to eq('Update everywhere')
49
- expect(find('#paramsName3')).to have_content('Update everywhere')
45
+ fill_in('paramsName2', with: 'Update everywhere')
46
+ expect(find('#paramsName1').value).to eq('Update everywhere')
47
+ expect(find('#paramsName2').value).to eq('Update everywhere')
48
+ expect(find('#paramsName3')).to have_content('Update everywhere')
50
49
 
51
- if ENV['BROWSER'] != 'phantom'
52
- expect(current_url).to match(/\/bindings[?]name[=]Update%20everywhere$/)
53
- end
50
+ if ENV['BROWSER'] != 'phantom'
51
+ expect(current_url).to match(/\/bindings[?]name[=]Update%20everywhere$/)
54
52
  end
53
+ end
55
54
 
56
- it 'should update the url and fields when bound to a param in the route' do
57
- visit '/'
55
+ it 'should update the url and fields when bound to a param in the route' do
56
+ visit '/'
58
57
 
59
- click_link 'Bindings'
58
+ click_link 'Bindings'
60
59
 
61
- # phantom does not support the html5 history api
62
- # TODO: We could probably polyfill this in phantom
63
- if ENV['BROWSER'] != 'phantom'
64
- expect(current_path).to eq('/bindings')
65
- end
60
+ # phantom does not support the html5 history api
61
+ # TODO: We could probably polyfill this in phantom
62
+ if ENV['BROWSER'] != 'phantom'
63
+ expect(current_path).to eq('/bindings')
64
+ end
66
65
 
67
- # Fill in one field and see if it updates the rest
68
- fill_in('routesName1', with: 'Routes bindings')
69
- expect(find('#routesName1').value).to eq('Routes bindings')
70
- expect(find('#routesName2').value).to eq('Routes bindings')
71
- expect(find('#routesName3')).to have_content('Routes bindings')
66
+ # Fill in one field and see if it updates the rest
67
+ fill_in('routesName1', with: 'Routes bindings')
68
+ expect(find('#routesName1').value).to eq('Routes bindings')
69
+ expect(find('#routesName2').value).to eq('Routes bindings')
70
+ expect(find('#routesName3')).to have_content('Routes bindings')
72
71
 
73
- fill_in('routesName2', with: 'bound_url')
74
- expect(find('#routesName1').value).to eq('bound_url')
75
- expect(find('#routesName2').value).to eq('bound_url')
76
- expect(find('#routesName3')).to have_content('bound_url')
72
+ fill_in('routesName2', with: 'bound_url')
73
+ expect(find('#routesName1').value).to eq('bound_url')
74
+ expect(find('#routesName2').value).to eq('bound_url')
75
+ expect(find('#routesName3')).to have_content('bound_url')
77
76
 
78
- if ENV['BROWSER'] != 'phantom'
79
- expect(current_path).to eq('/bindings/bound_url')
80
- end
77
+ if ENV['BROWSER'] != 'phantom'
78
+ expect(current_path).to eq('/bindings/bound_url')
81
79
  end
80
+ end
82
81
 
83
- it 'should go from a url and query to params' do
84
- visit '/bindings/testing?name=cool'
82
+ it 'should go from a url and query to params' do
83
+ visit '/bindings/testing?name=cool'
85
84
 
86
- expect(find('#paramsName3')).to have_content('cool')
87
- expect(find('#routesName3')).to have_content('testing')
88
- end
85
+ expect(find('#paramsName3')).to have_content('cool')
86
+ expect(find('#routesName3')).to have_content('testing')
87
+ end
89
88
 
90
- it 'should load the bindings page and update bindings' do
91
- visit '/'
89
+ it 'should load the bindings page and update bindings' do
90
+ visit '/'
92
91
 
93
- click_link 'Bindings'
92
+ click_link 'Bindings'
94
93
 
95
- # Fill in one field and see if it updates the rest
96
- fill_in('textareaName1', with: 'Page bindings')
97
- expect(find('#textareaName1').value).to eq('Page bindings')
98
- expect(find('#textareaName2').value).to eq('Page bindings')
99
- expect(find('#textareaName3')).to have_content('Page bindings')
94
+ # Fill in one field and see if it updates the rest
95
+ fill_in('textareaName1', with: 'Page bindings')
96
+ expect(find('#textareaName1').value).to eq('Page bindings')
97
+ expect(find('#textareaName2').value).to eq('Page bindings')
98
+ expect(find('#textareaName3')).to have_content('Page bindings')
100
99
 
101
- fill_in('textareaName2', with: 'Update everywhere')
102
- expect(find('#textareaName1').value).to eq('Update everywhere')
103
- expect(find('#textareaName2').value).to eq('Update everywhere')
104
- expect(find('#textareaName3')).to have_content('Update everywhere')
105
- end
106
-
107
- it 'should update local_store bindings' do
108
- visit '/'
100
+ fill_in('textareaName2', with: 'Update everywhere')
101
+ expect(find('#textareaName1').value).to eq('Update everywhere')
102
+ expect(find('#textareaName2').value).to eq('Update everywhere')
103
+ expect(find('#textareaName3')).to have_content('Update everywhere')
104
+ end
109
105
 
110
- click_link 'Bindings'
106
+ it 'should update local_store bindings' do
107
+ visit '/'
111
108
 
112
- # Fill in one field and see if it updates the rest
113
- fill_in('localstoreName1', with: 'Page bindings')
114
- expect(find('#localstoreName1').value).to eq('Page bindings')
115
- expect(find('#localstoreName2').value).to eq('Page bindings')
116
- expect(find('#localstoreName3')).to have_content('Page bindings')
109
+ click_link 'Bindings'
117
110
 
118
- fill_in('localstoreName2', with: 'Update everywhere')
119
- expect(find('#localstoreName1').value).to eq('Update everywhere')
120
- expect(find('#localstoreName2').value).to eq('Update everywhere')
121
- expect(find('#localstoreName3')).to have_content('Update everywhere')
122
- end
111
+ # Fill in one field and see if it updates the rest
112
+ fill_in('localstoreName1', with: 'Page bindings')
113
+ expect(find('#localstoreName1').value).to eq('Page bindings')
114
+ expect(find('#localstoreName2').value).to eq('Page bindings')
115
+ expect(find('#localstoreName3')).to have_content('Page bindings')
123
116
 
124
- # it 'should update local_store bindings' do
125
- # visit '/'
126
- #
127
- # click_link 'Bindings'
128
- #
129
- # within '#pageSelect1' do
130
- # find("option[value='two']").click
131
- # end
132
- #
133
- # # Fill in one field and see if it updates the rest
134
- # expect(find('#pageSelect1').value).to eq('two')
135
- # expect(find('#pageSelect2').value).to eq('two')
136
- # expect(find('#pageSelect3')).to have_content('two')
137
- #
138
- # # Fill in one field and see if it updates the rest
139
- # fill_in('pageSelect2', :with => 'three')
140
- # expect(find('#pageSelect1').value).to eq('three')
141
- # expect(find('#pageSelect2').value).to eq('three')
142
- # expect(find('#pageSelect3')).to have_content('three')
143
- # end
117
+ fill_in('localstoreName2', with: 'Update everywhere')
118
+ expect(find('#localstoreName1').value).to eq('Update everywhere')
119
+ expect(find('#localstoreName2').value).to eq('Update everywhere')
120
+ expect(find('#localstoreName3')).to have_content('Update everywhere')
144
121
  end
145
122
 
146
- describe 'check boxes' do
147
- it 'should load the bindings page and update checkboxes' do
148
- visit '/'
123
+ # it 'should update local_store bindings' do
124
+ # visit '/'
125
+ #
126
+ # click_link 'Bindings'
127
+ #
128
+ # within '#pageSelect1' do
129
+ # find("option[value='two']").click
130
+ # end
131
+ #
132
+ # # Fill in one field and see if it updates the rest
133
+ # expect(find('#pageSelect1').value).to eq('two')
134
+ # expect(find('#pageSelect2').value).to eq('two')
135
+ # expect(find('#pageSelect3')).to have_content('two')
136
+ #
137
+ # # Fill in one field and see if it updates the rest
138
+ # fill_in('pageSelect2', :with => 'three')
139
+ # expect(find('#pageSelect1').value).to eq('three')
140
+ # expect(find('#pageSelect2').value).to eq('three')
141
+ # expect(find('#pageSelect3')).to have_content('three')
142
+ # end
143
+ end
149
144
 
150
- click_link 'Bindings'
145
+ describe 'check boxes' do
146
+ it 'should load the bindings page and update checkboxes' do
147
+ visit '/'
151
148
 
152
- expect(find('#pageCheck3')).to have_content('')
153
- # Fill in one field and see if it updates the rest
154
- check('pageCheck1')
155
- expect(find('#pageCheck1')).to be_checked
156
- expect(find('#pageCheck2')).to be_checked
157
- expect(find('#pageCheck3')).to have_content('true')
149
+ click_link 'Bindings'
158
150
 
159
- uncheck('pageCheck1')
160
- expect(find('#pageCheck1')).to_not be_checked
161
- expect(find('#pageCheck2')).to_not be_checked
162
- expect(find('#pageCheck3')).to have_content('')
163
- end
151
+ expect(find('#pageCheck3')).to have_content('')
152
+ # Fill in one field and see if it updates the rest
153
+ check('pageCheck1')
154
+ expect(find('#pageCheck1')).to be_checked
155
+ expect(find('#pageCheck2')).to be_checked
156
+ expect(find('#pageCheck3')).to have_content('true')
164
157
 
165
- it 'should load the bindings page and update checkboxes bound to params' do
166
- visit '/'
158
+ uncheck('pageCheck1')
159
+ expect(find('#pageCheck1')).to_not be_checked
160
+ expect(find('#pageCheck2')).to_not be_checked
161
+ expect(find('#pageCheck3')).to have_content('')
162
+ end
167
163
 
168
- click_link 'Bindings'
164
+ it 'should load the bindings page and update checkboxes bound to params' do
165
+ visit '/'
166
+
167
+ click_link 'Bindings'
169
168
 
170
- if ENV['BROWSER'] != 'phantom'
171
- expect(current_path).to eq('/bindings')
172
- end
169
+ if ENV['BROWSER'] != 'phantom'
170
+ expect(current_path).to eq('/bindings')
171
+ end
173
172
 
174
- expect(find('#paramsCheck3')).to have_content('')
175
- # Fill in one field and see if it updates the rest
176
- check('paramsCheck1')
177
- expect(find('#paramsCheck1')).to be_checked
178
- expect(find('#paramsCheck2')).to be_checked
179
- expect(find('#paramsCheck3')).to have_content('true')
173
+ expect(find('#paramsCheck3')).to have_content('')
174
+ # Fill in one field and see if it updates the rest
175
+ check('paramsCheck1')
176
+ expect(find('#paramsCheck1')).to be_checked
177
+ expect(find('#paramsCheck2')).to be_checked
178
+ expect(find('#paramsCheck3')).to have_content('true')
180
179
 
181
- if ENV['BROWSER'] != 'phantom'
182
- expect(current_url).to match(/\/bindings[?]check[=]true$/)
183
- end
180
+ if ENV['BROWSER'] != 'phantom'
181
+ expect(current_url).to match(/\/bindings[?]check[=]true$/)
182
+ end
184
183
 
185
- uncheck('paramsCheck1')
186
- expect(find('#paramsCheck1')).to_not be_checked
187
- expect(find('#paramsCheck2')).to_not be_checked
188
- expect(find('#paramsCheck3')).to have_content('')
184
+ uncheck('paramsCheck1')
185
+ expect(find('#paramsCheck1')).to_not be_checked
186
+ expect(find('#paramsCheck2')).to_not be_checked
187
+ expect(find('#paramsCheck3')).to have_content('')
189
188
 
190
- if ENV['BROWSER'] != 'phantom'
191
- expect(current_url).to match(/\/bindings[?]check[=]false$/)
192
- end
189
+ if ENV['BROWSER'] != 'phantom'
190
+ expect(current_url).to match(/\/bindings[?]check[=]false$/)
193
191
  end
194
192
  end
193
+ end
195
194
 
196
- describe 'content escaping' do
197
- it 'should escape in a tripple stash' do
198
- visit '/'
195
+ describe 'content escaping' do
196
+ it 'should escape in a tripple stash' do
197
+ visit '/'
199
198
 
200
- click_link 'Bindings'
199
+ click_link 'Bindings'
201
200
 
202
- expect(find('#escapeContent')).to have_content('this is {{escaped}}')
203
- end
201
+ expect(find('#escapeContent')).to have_content('this is {{escaped}}')
204
202
  end
205
203
  end
206
204
  end
@@ -1,47 +1,45 @@
1
- if ENV['BROWSER']
2
- require 'spec_helper'
1
+ require 'spec_helper'
3
2
 
4
- describe 'cookies collection', type: :feature, sauce: true do
5
- if ENV['BROWSER'] != 'phantom'
6
- # TODO: fails in phantom for some reason
7
- it 'should add' do
8
- visit '/'
3
+ describe 'cookies collection', type: :feature, sauce: true do
4
+ if ENV['BROWSER'] != 'phantom'
5
+ # TODO: fails in phantom for some reason
6
+ it 'should add' do
7
+ visit '/'
9
8
 
10
- click_link 'Cookies'
9
+ click_link 'Cookies'
11
10
 
12
- fill_in('cookieName', with: 'one')
13
- fill_in('cookieValue', with: 'one')
14
- click_button 'Add Cookie'
11
+ fill_in('cookieName', with: 'one')
12
+ fill_in('cookieValue', with: 'one')
13
+ click_button 'Add Cookie'
15
14
 
16
- expect(page).to have_content('one: one')
15
+ expect(page).to have_content('one: one')
17
16
 
18
- # Reload the page
19
- page.evaluate_script('document.location.reload()')
17
+ # Reload the page
18
+ page.evaluate_script('document.location.reload()')
20
19
 
21
- # Check again
22
- expect(page).to have_content('one: one')
23
- end
20
+ # Check again
21
+ expect(page).to have_content('one: one')
24
22
  end
23
+ end
25
24
 
26
- it 'should delete cookies' do
27
- visit '/'
25
+ it 'should delete cookies' do
26
+ visit '/'
28
27
 
29
- click_link 'Cookies'
28
+ click_link 'Cookies'
30
29
 
31
- fill_in('cookieName', with: 'two')
32
- fill_in('cookieValue', with: 'two')
33
- click_button 'Add Cookie'
30
+ fill_in('cookieName', with: 'two')
31
+ fill_in('cookieValue', with: 'two')
32
+ click_button 'Add Cookie'
34
33
 
35
- expect(page).to have_content('two: two')
34
+ expect(page).to have_content('two: two')
36
35
 
37
- find('.cookieDelete').click
36
+ find('.cookieDelete').click
38
37
 
39
- expect(page).to_not have_content('two: two')
38
+ expect(page).to_not have_content('two: two')
40
39
 
41
- # Reload the page
42
- page.evaluate_script('document.location.reload()')
40
+ # Reload the page
41
+ page.evaluate_script('document.location.reload()')
43
42
 
44
- expect(page).to_not have_content('two: two')
45
- end
43
+ expect(page).to_not have_content('two: two')
46
44
  end
47
45
  end