actionpack 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +17 -0
- data/Rakefile +10 -6
- data/lib/action_controller.rb +0 -0
- data/lib/action_controller/assertions/response_assertions.rb +1 -1
- data/lib/action_controller/assertions/selector_assertions.rb +26 -46
- data/lib/action_controller/base.rb +8 -4
- data/lib/action_controller/dispatcher.rb +1 -1
- data/lib/action_controller/filters.rb +194 -195
- data/lib/action_controller/polymorphic_routes.rb +25 -12
- data/lib/action_controller/record_identifier.rb +20 -13
- data/lib/action_controller/request.rb +9 -6
- data/lib/action_controller/request_profiler.rb +0 -0
- data/lib/action_controller/response.rb +0 -0
- data/lib/action_controller/routing.rb +5 -1
- data/lib/action_controller/routing/builder.rb +1 -2
- data/lib/action_controller/routing/segments.rb +1 -1
- data/lib/action_controller/templates/rescues/layout.erb +1 -1
- data/lib/action_controller/test_process.rb +4 -2
- data/lib/action_controller/vendor/html-scanner/html/document.rb +1 -1
- data/lib/action_controller/verification.rb +1 -1
- data/lib/action_pack/version.rb +1 -1
- data/lib/action_view/base.rb +7 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +14 -11
- data/lib/action_view/helpers/date_helper.rb +3 -3
- data/lib/action_view/helpers/form_helper.rb +5 -1
- data/lib/action_view/helpers/form_options_helper.rb +2 -2
- data/lib/action_view/helpers/form_tag_helper.rb +5 -3
- data/lib/action_view/helpers/javascript_helper.rb +4 -4
- data/lib/action_view/helpers/prototype_helper.rb +7 -7
- data/lib/action_view/helpers/tag_helper.rb +4 -3
- data/lib/action_view/helpers/text_helper.rb +1 -1
- data/lib/action_view/helpers/url_helper.rb +3 -5
- data/lib/action_view/partial_template.rb +1 -1
- data/test/controller/action_pack_assertions_test.rb +24 -5
- data/test/controller/assert_select_test.rb +6 -1
- data/test/controller/base_test.rb +37 -1
- data/test/controller/cgi_test.rb +0 -0
- data/test/controller/dispatcher_test.rb +2 -2
- data/test/controller/html-scanner/document_test.rb +25 -0
- data/test/controller/integration_upload_test.rb +1 -1
- data/test/controller/new_render_test.rb +22 -3
- data/test/controller/polymorphic_routes_test.rb +33 -0
- data/test/controller/redirect_test.rb +0 -0
- data/test/controller/render_test.rb +1 -1
- data/test/controller/request_test.rb +6 -0
- data/test/controller/resources_test.rb +15 -17
- data/test/controller/routing_test.rb +22 -2
- data/test/controller/session/cookie_store_test.rb +0 -0
- data/test/controller/test_test.rb +11 -2
- data/test/controller/verification_test.rb +34 -17
- data/test/fixtures/test/render_file_from_template.html.erb +1 -0
- data/test/template/date_helper_test.rb +59 -8
- data/test/template/deprecated_erb_variable_test.rb +9 -0
- data/test/template/form_options_helper_test.rb +505 -514
- data/test/template/form_tag_helper_test.rb +13 -0
- data/test/template/javascript_helper_test.rb +7 -4
- data/test/template/prototype_helper_test.rb +14 -6
- data/test/template/text_helper_test.rb +1 -0
- data/test/template/url_helper_test.rb +11 -1
- metadata +8 -4
@@ -190,6 +190,12 @@ class FormTagHelperTest < ActionView::TestCase
|
|
190
190
|
assert_dom_equal expected, actual
|
191
191
|
end
|
192
192
|
|
193
|
+
def test_label_tag_with_symbol
|
194
|
+
actual = label_tag :title
|
195
|
+
expected = %(<label for="title">Title</label>)
|
196
|
+
assert_dom_equal expected, actual
|
197
|
+
end
|
198
|
+
|
193
199
|
def test_label_tag_with_text
|
194
200
|
actual = label_tag "title", "My Title"
|
195
201
|
expected = %(<label for="title">My Title</label>)
|
@@ -222,6 +228,13 @@ class FormTagHelperTest < ActionView::TestCase
|
|
222
228
|
)
|
223
229
|
end
|
224
230
|
|
231
|
+
def test_submit_tag_with_no_onclick_options
|
232
|
+
assert_dom_equal(
|
233
|
+
%(<input name='commit' type='submit' value='Save' onclick="this.setAttribute('originalValue', this.value);this.disabled=true;this.value='Saving...';result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = this.getAttribute('originalValue'); this.disabled = false };return result;" />),
|
234
|
+
submit_tag("Save", :disable_with => "Saving...")
|
235
|
+
)
|
236
|
+
end
|
237
|
+
|
225
238
|
def test_submit_tag_with_confirmation
|
226
239
|
assert_dom_equal(
|
227
240
|
%(<input name='commit' type='submit' value='Save' onclick="return confirm('Are you sure?');"/>),
|
@@ -4,11 +4,14 @@ class JavaScriptHelperTest < ActionView::TestCase
|
|
4
4
|
tests ActionView::Helpers::JavaScriptHelper
|
5
5
|
|
6
6
|
def test_define_javascript_functions
|
7
|
-
|
8
|
-
|
7
|
+
assert_deprecated(/javascript_include_tag/) do
|
8
|
+
# check if prototype.js is included first
|
9
|
+
src = define_javascript_functions
|
10
|
+
assert_not_nil src.split("\n")[1].match(/Prototype JavaScript framework/)
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
# check that scriptaculous.js is not in here, only needed if loaded remotely
|
13
|
+
assert_nil src.split("\n")[1].match(/var Scriptaculous = \{/)
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
def test_escape_javascript
|
@@ -77,6 +77,10 @@ class PrototypeHelperTest < PrototypeHelperBaseTest
|
|
77
77
|
link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot" })
|
78
78
|
assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>),
|
79
79
|
link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
|
80
|
+
assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:false, evalScripts:true}); return false;\">Remote outauthor</a>),
|
81
|
+
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :type => :synchronous)
|
82
|
+
assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, insertion:'bottom'}); return false;\">Remote outauthor</a>),
|
83
|
+
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
|
80
84
|
end
|
81
85
|
|
82
86
|
def test_link_to_remote_html_options
|
@@ -288,13 +292,13 @@ class JavaScriptGeneratorTest < PrototypeHelperBaseTest
|
|
288
292
|
end
|
289
293
|
|
290
294
|
def test_insert_html_with_string
|
291
|
-
assert_equal '
|
295
|
+
assert_equal 'Element.insert("element", { top: "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E" });',
|
292
296
|
@generator.insert_html(:top, 'element', '<p>This is a test</p>')
|
293
|
-
assert_equal '
|
297
|
+
assert_equal 'Element.insert("element", { bottom: "\\u003Cp\u003EThis is a test\\u003C/p\u003E" });',
|
294
298
|
@generator.insert_html(:bottom, 'element', '<p>This is a test</p>')
|
295
|
-
assert_equal '
|
299
|
+
assert_equal 'Element.insert("element", { before: "\\u003Cp\u003EThis is a test\\u003C/p\u003E" });',
|
296
300
|
@generator.insert_html(:before, 'element', '<p>This is a test</p>')
|
297
|
-
assert_equal '
|
301
|
+
assert_equal 'Element.insert("element", { after: "\\u003Cp\u003EThis is a test\\u003C/p\u003E" });',
|
298
302
|
@generator.insert_html(:after, 'element', '<p>This is a test</p>')
|
299
303
|
end
|
300
304
|
|
@@ -362,8 +366,8 @@ class JavaScriptGeneratorTest < PrototypeHelperBaseTest
|
|
362
366
|
@generator.replace_html('baz', '<p>This is a test</p>')
|
363
367
|
|
364
368
|
assert_equal <<-EOS.chomp, @generator.to_s
|
365
|
-
|
366
|
-
|
369
|
+
Element.insert("element", { top: "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E" });
|
370
|
+
Element.insert("element", { bottom: "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E" });
|
367
371
|
["foo", "bar"].each(Element.remove);
|
368
372
|
Element.update("baz", "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E");
|
369
373
|
EOS
|
@@ -425,6 +429,8 @@ Element.update("baz", "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E");
|
|
425
429
|
def test_sortable
|
426
430
|
assert_equal %(Sortable.create("blah", {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize("blah")})}});),
|
427
431
|
@generator.sortable('blah', :url => { :action => "order" })
|
432
|
+
assert_equal %(Sortable.create("blah", {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:false, evalScripts:true, parameters:Sortable.serialize("blah")})}});),
|
433
|
+
@generator.sortable('blah', :url => { :action => "order" }, :type => :synchronous)
|
428
434
|
end
|
429
435
|
|
430
436
|
def test_draggable
|
@@ -435,6 +441,8 @@ Element.update("baz", "\\u003Cp\\u003EThis is a test\\u003C/p\\u003E");
|
|
435
441
|
def test_drop_receiving
|
436
442
|
assert_equal %(Droppables.add("blah", {onDrop:function(element){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}});),
|
437
443
|
@generator.drop_receiving('blah', :url => { :action => "order" })
|
444
|
+
assert_equal %(Droppables.add("blah", {onDrop:function(element){new Ajax.Request('http://www.example.com/order', {asynchronous:false, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}});),
|
445
|
+
@generator.drop_receiving('blah', :url => { :action => "order" }, :type => :synchronous)
|
438
446
|
end
|
439
447
|
|
440
448
|
def test_collection_first_and_last
|
@@ -187,6 +187,7 @@ class TextHelperTest < ActionView::TestCase
|
|
187
187
|
http://www.mail-archive.com/rails@lists.rubyonrails.org/
|
188
188
|
http://www.amazon.com/Testing-Equal-Sign-In-Path/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1198861734&sr=8-1
|
189
189
|
http://en.wikipedia.org/wiki/Sprite_(computer_graphics)
|
190
|
+
http://en.wikipedia.org/wiki/Texas_hold'em
|
190
191
|
)
|
191
192
|
|
192
193
|
urls.each do |url|
|
@@ -284,6 +284,7 @@ class UrlHelperTest < ActionView::TestCase
|
|
284
284
|
assert_dom_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex", :replace_at => "(at)")
|
285
285
|
assert_dom_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">me(at)domain(dot)com</a>", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)", :replace_dot => "(dot)")
|
286
286
|
assert_dom_equal "<script type=\"text/javascript\">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)")
|
287
|
+
assert_dom_equal "<script type=\"text/javascript\">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%6d%65%28%61%74%29%64%6f%6d%61%69%6e%28%64%6f%74%29%63%6f%6d%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", nil, :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)")
|
287
288
|
end
|
288
289
|
|
289
290
|
def protect_against_forgery?
|
@@ -305,6 +306,10 @@ class UrlHelperWithControllerTest < ActionView::TestCase
|
|
305
306
|
render :inline => "<%= show_named_route_#{params[:kind]} %>"
|
306
307
|
end
|
307
308
|
|
309
|
+
def nil_url_for
|
310
|
+
render :inline => '<%= url_for(nil) %>'
|
311
|
+
end
|
312
|
+
|
308
313
|
def rescue_action(e) raise e end
|
309
314
|
end
|
310
315
|
|
@@ -321,7 +326,7 @@ class UrlHelperWithControllerTest < ActionView::TestCase
|
|
321
326
|
assert_equal '/url_helper_with_controller/show_url_for', @response.body
|
322
327
|
end
|
323
328
|
|
324
|
-
def
|
329
|
+
def test_named_route_url_shows_host_and_path
|
325
330
|
with_url_helper_routing do
|
326
331
|
get :show_named_route, :kind => 'url'
|
327
332
|
assert_equal 'http://test.host/url_helper_with_controller/show_named_route', @response.body
|
@@ -335,6 +340,11 @@ class UrlHelperWithControllerTest < ActionView::TestCase
|
|
335
340
|
end
|
336
341
|
end
|
337
342
|
|
343
|
+
def test_url_for_nil_returns_current_path
|
344
|
+
get :nil_url_for
|
345
|
+
assert_equal '/url_helper_with_controller/nil_url_for', @response.body
|
346
|
+
end
|
347
|
+
|
338
348
|
protected
|
339
349
|
def with_url_helper_routing
|
340
350
|
with_routing do |set|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionpack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -9,17 +9,18 @@ autorequire: action_controller
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-04 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - "="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 2.1.
|
23
|
+
version: 2.1.1
|
23
24
|
version:
|
24
25
|
description: Eases web-request routing, handling, and response as a half-way front, half-way page controller. Implemented with specific emphasis on enabling easy unit/integration testing that doesn't require a browser.
|
25
26
|
email: david@loudthinking.com
|
@@ -340,6 +341,7 @@ files:
|
|
340
341
|
- test/fixtures/public/javascripts
|
341
342
|
- test/fixtures/public/javascripts/application.js
|
342
343
|
- test/fixtures/public/javascripts/bank.js
|
344
|
+
- test/fixtures/public/javascripts/cache
|
343
345
|
- test/fixtures/public/javascripts/controls.js
|
344
346
|
- test/fixtures/public/javascripts/dragdrop.js
|
345
347
|
- test/fixtures/public/javascripts/effects.js
|
@@ -418,6 +420,7 @@ files:
|
|
418
420
|
- test/fixtures/test/list.erb
|
419
421
|
- test/fixtures/test/non_erb_block_content_for.builder
|
420
422
|
- test/fixtures/test/potential_conflicts.erb
|
423
|
+
- test/fixtures/test/render_file_from_template.html.erb
|
421
424
|
- test/fixtures/test/render_file_with_ivar.erb
|
422
425
|
- test/fixtures/test/render_file_with_locals.erb
|
423
426
|
- test/fixtures/test/render_to_string_test.erb
|
@@ -433,6 +436,7 @@ files:
|
|
433
436
|
- test/template/atom_feed_helper_test.rb
|
434
437
|
- test/template/benchmark_helper_test.rb
|
435
438
|
- test/template/date_helper_test.rb
|
439
|
+
- test/template/deprecated_erb_variable_test.rb
|
436
440
|
- test/template/erb_util_test.rb
|
437
441
|
- test/template/form_helper_test.rb
|
438
442
|
- test/template/form_options_helper_test.rb
|
@@ -472,7 +476,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
472
476
|
requirements:
|
473
477
|
- none
|
474
478
|
rubyforge_project: actionpack
|
475
|
-
rubygems_version: 1.0
|
479
|
+
rubygems_version: 1.2.0
|
476
480
|
signing_key:
|
477
481
|
specification_version: 2
|
478
482
|
summary: Web-flow and rendering framework putting the VC in MVC.
|