actionpack 1.7.0 → 1.8.0

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.

Files changed (65) hide show
  1. data/CHANGELOG +109 -0
  2. data/README +2 -2
  3. data/RUNNING_UNIT_TESTS +1 -1
  4. data/install.rb +8 -77
  5. data/lib/action_controller/assertions.rb +203 -0
  6. data/lib/action_controller/base.rb +15 -7
  7. data/lib/action_controller/benchmarking.rb +10 -4
  8. data/lib/action_controller/caching.rb +28 -17
  9. data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +5 -9
  10. data/lib/action_controller/cgi_process.rb +5 -1
  11. data/lib/action_controller/cookies.rb +3 -2
  12. data/lib/action_controller/deprecated_assertions.rb +204 -0
  13. data/lib/action_controller/flash.rb +30 -36
  14. data/lib/action_controller/pagination.rb +4 -4
  15. data/lib/action_controller/request.rb +18 -2
  16. data/lib/action_controller/routing.rb +6 -2
  17. data/lib/action_controller/scaffolding.rb +1 -1
  18. data/lib/action_controller/templates/rescues/diagnostics.rhtml +1 -1
  19. data/lib/action_controller/templates/rescues/routing_error.rhtml +4 -2
  20. data/lib/action_controller/templates/rescues/template_error.rhtml +5 -4
  21. data/lib/action_controller/templates/scaffolds/list.rhtml +3 -0
  22. data/lib/action_controller/test_process.rb +60 -17
  23. data/lib/action_controller/url_rewriter.rb +3 -3
  24. data/lib/action_controller/vendor/html-scanner/html/document.rb +63 -0
  25. data/lib/action_controller/vendor/html-scanner/html/node.rb +431 -0
  26. data/lib/action_controller/vendor/html-scanner/html/tokenizer.rb +95 -0
  27. data/lib/action_controller/vendor/html-scanner/html/version.rb +11 -0
  28. data/lib/action_controller/verification.rb +13 -4
  29. data/lib/action_view/base.rb +3 -2
  30. data/lib/action_view/helpers/active_record_helper.rb +1 -1
  31. data/lib/action_view/helpers/asset_tag_helper.rb +31 -9
  32. data/lib/action_view/helpers/date_helper.rb +25 -22
  33. data/lib/action_view/helpers/form_helper.rb +6 -5
  34. data/lib/action_view/helpers/form_options_helper.rb +4 -4
  35. data/lib/action_view/helpers/javascript_helper.rb +28 -6
  36. data/lib/action_view/helpers/javascripts/prototype.js +340 -30
  37. data/lib/action_view/helpers/number_helper.rb +110 -0
  38. data/lib/action_view/helpers/pagination_helper.rb +1 -1
  39. data/lib/action_view/helpers/text_helper.rb +8 -21
  40. data/lib/action_view/helpers/url_helper.rb +21 -4
  41. data/lib/action_view/partials.rb +39 -9
  42. data/rakefile +29 -5
  43. data/test/abstract_unit.rb +1 -0
  44. data/test/controller/action_pack_assertions_test.rb +1 -2
  45. data/test/controller/active_record_assertions_test.rb +1 -1
  46. data/test/controller/cgi_test.rb +0 -1
  47. data/test/controller/cookie_test.rb +11 -1
  48. data/test/controller/helper_test.rb +0 -12
  49. data/test/controller/render_test.rb +9 -0
  50. data/test/controller/request_test.rb +44 -1
  51. data/test/controller/routing_tests.rb +4 -1
  52. data/test/controller/test_test.rb +62 -0
  53. data/test/controller/verification_test.rb +21 -0
  54. data/test/fixtures/test/_partial_only.rhtml +1 -0
  55. data/test/template/active_record_helper_test.rb +2 -2
  56. data/test/template/asset_tag_helper_test.rb +52 -4
  57. data/test/template/date_helper_test.rb +163 -32
  58. data/test/template/form_helper_test.rb +9 -6
  59. data/test/template/form_options_helper_test.rb +18 -15
  60. data/test/template/number_helper_test.rb +51 -0
  61. data/test/template/text_helper_test.rb +17 -20
  62. data/test/template/url_helper_test.rb +7 -1
  63. metadata +15 -6
  64. data/lib/action_controller/assertions/action_pack_assertions.rb +0 -260
  65. data/lib/action_controller/assertions/active_record_assertions.rb +0 -65
@@ -1,65 +0,0 @@
1
- require 'test/unit'
2
- require 'test/unit/assertions'
3
- # active_record is assumed to be loaded by this point
4
-
5
- module Test #:nodoc:
6
- module Unit #:nodoc:
7
- module Assertions
8
- # Assert the template object with the given name is an Active Record descendant and is valid.
9
- def assert_valid_record(key = nil, message = nil)
10
- record = find_record_in_template(key)
11
- msg = build_message(message, "Active Record is invalid <?>)", record.errors.full_messages)
12
- assert_block(msg) { record.valid? }
13
- end
14
-
15
- # Assert the template object with the given name is an Active Record descendant and is invalid.
16
- def assert_invalid_record(key = nil, message = nil)
17
- record = find_record_in_template(key)
18
- msg = build_message(message, "Active Record is valid)")
19
- assert_block(msg) { !record.valid? }
20
- end
21
-
22
- # Assert the template object with the given name is an Active Record descendant and the specified column(s) are valid.
23
- def assert_valid_column_on_record(key = nil, columns = "", message = nil)
24
- record = find_record_in_template(key)
25
- record.send(:validate)
26
-
27
- cols = glue_columns(columns)
28
- cols.delete_if { |col| !record.errors.invalid?(col) }
29
- msg = build_message(message, "Active Record has invalid columns <?>)", cols.join(",") )
30
- assert_block(msg) { cols.empty? }
31
- end
32
-
33
- # Assert the template object with the given name is an Active Record descendant and the specified column(s) are invalid.
34
- def assert_invalid_column_on_record(key = nil, columns = "", message = nil)
35
- record = find_record_in_template(key)
36
- record.send(:validate)
37
-
38
- cols = glue_columns(columns)
39
- cols.delete_if { |col| record.errors.invalid?(col) }
40
- msg = build_message(message, "Active Record has valid columns <?>)", cols.join(",") )
41
- assert_block(msg) { cols.empty? }
42
- end
43
-
44
- private
45
- def glue_columns(columns)
46
- cols = []
47
- cols << columns if columns.class == String
48
- cols += columns if columns.class == Array
49
- cols
50
- end
51
-
52
- def find_record_in_template(key = nil)
53
- response = acquire_assertion_target
54
-
55
- assert_template_has(key)
56
- record = response.template_objects[key]
57
-
58
- assert_not_nil(record)
59
- assert_kind_of ActiveRecord::Base, record
60
-
61
- return record
62
- end
63
- end
64
- end
65
- end