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
@@ -0,0 +1,110 @@
1
+ module ActionView
2
+ module Helpers
3
+ # Provides methods for converting a number into a formatted string that currently represents
4
+ # one of the following forms: phone number, percentage, money, or precision level.
5
+ module NumberHelper
6
+
7
+ # Formats a +number+ into a US phone number string. The +options+ can be hash used to customize the format of the output.
8
+ # The area code can be surrounded by parenthesis by setting +:area_code+ to true; default is false
9
+ # The delimiter can be set using +:delimiter+; default is "-"
10
+ # Examples:
11
+ # number_to_phone(1235551234) => 123-555-1234
12
+ # number_to_phone(1235551234, {:area_code => true}) => (123) 555-1234
13
+ # number_to_phone(1235551234, {:delimiter => " "}) => 123 555 1234
14
+ def number_to_phone(number, options = {})
15
+ options = options.stringify_keys
16
+ area_code = options.delete("area_code") { false }
17
+ delimiter = options.delete("delimiter") { "-" }
18
+ begin
19
+ str = number.to_s
20
+ if area_code == true
21
+ str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"(\\1) \\2#{delimiter}\\3")
22
+ else
23
+ str.gsub!(/([0-9]{3})([0-9]{3})([0-9]{4})/,"\\1#{delimiter}\\2#{delimiter}\\3")
24
+ end
25
+ rescue
26
+ number
27
+ end
28
+ end
29
+
30
+ # Formates a +number+ into a currency string. The +options+ hash can be used to customize the format of the output.
31
+ # The +number+ can contain a level of precision using the +precision+ key; default is 2
32
+ # The currency type can be set using the +unit+ key; default is "$"
33
+ # The unit separator can be set using the +separator+ key; default is "."
34
+ # The delimiter can be set using the +delimiter+ key; default is ","
35
+ # Examples:
36
+ # number_to_currency(1234567890.50) => $1,234,567,890.50
37
+ # number_to_currency(1234567890.506) => $1,234,567,890.51
38
+ # number_to_currency(1234567890.50, {:unit => "£", :separator => ",", :delimiter => ""}) => £1234567890,50
39
+ def number_to_currency(number, options = {})
40
+ options = options.stringify_keys
41
+ precision, unit, separator, delimiter = options.delete("precision") { 2 }, options.delete("unit") { "$" }, options.delete("separator") { "." }, options.delete("delimiter") { "," }
42
+ begin
43
+ parts = number_with_precision(number, precision).split('.')
44
+ unit + number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s
45
+ rescue
46
+ number
47
+ end
48
+ end
49
+
50
+ # Formats a +number+ as into a percentage string. The +options+ hash can be used to customize the format of the output.
51
+ # The +number+ can contain a level of precision using the +precision+ key; default is 3
52
+ # The unit separator can be set using the +separator+ key; default is "."
53
+ # Examples:
54
+ # number_to_precision(100) => 100.000%
55
+ # number_to_precision(100, {:precision => 0}) => 100%
56
+ # number_to_precision(302.0574, {:precision => 2}) => 302.06%
57
+ def number_to_percentage(number, options = {})
58
+ options = options.stringify_keys
59
+ precision, separator = options.delete("precision") { 3 }, options.delete("separator") { "." }
60
+ begin
61
+ number = number_with_precision(number, precision)
62
+ parts = number.split('.')
63
+ if parts.at(1).nil?
64
+ parts[0] + "%"
65
+ else
66
+ parts[0] + separator + parts[1].to_s + "%"
67
+ end
68
+ rescue
69
+ number
70
+ end
71
+ end
72
+
73
+ # Formats a +number+ with a +delimiter+.
74
+ # Example:
75
+ # number_with_delimiter(12345678) => 12,345,678
76
+ def number_with_delimiter(number, delimiter=",")
77
+ number.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}")
78
+ end
79
+
80
+ # Returns a formatted-for-humans file size.
81
+ #
82
+ # Examples:
83
+ # human_size(123) => 123 Bytes
84
+ # human_size(1234) => 1.2 KB
85
+ # human_size(12345) => 12.1 KB
86
+ # human_size(1234567) => 1.2 MB
87
+ # human_size(1234567890) => 1.1 GB
88
+ def number_to_human_size(size)
89
+ begin
90
+ return "%d Bytes" % size if size < 1.kilobytes
91
+ return "%.1f KB" % (size/1.0.kilobytes) if size < 1.megabytes
92
+ return "%.1f MB" % (size/1.0.megabytes) if size < 1.gigabytes
93
+ return "%.1f GB" % (size/1.0.gigabytes) if size < 1.terabytes
94
+ return "%.1f TB" % (size/1.0.terabytes)
95
+ rescue
96
+ # just return nothing
97
+ end
98
+ end
99
+
100
+ alias_method :human_size, :number_to_human_size # deprecated alias
101
+
102
+ # Formats a +number+ with a level of +precision+.
103
+ # Example:
104
+ # number_with_precision(111.2345) => 111.235
105
+ def number_with_precision(number, precision=3)
106
+ sprintf("%01.#{precision}f", number)
107
+ end
108
+ end
109
+ end
110
+ end
@@ -6,7 +6,7 @@ module ActionView
6
6
  #
7
7
  # <%= link_to "Previous page", { :page => paginator.current.previous } if paginator.current.previous %>
8
8
  #
9
- # <%= link_to "Next page", { :page => paginator.current.next } of paginator.current.next =%>
9
+ # <%= link_to "Next page", { :page => paginator.current.next } if paginator.current.next =%>
10
10
  module PaginationHelper
11
11
  unless const_defined?(:DEFAULT_OPTIONS)
12
12
  DEFAULT_OPTIONS = {
@@ -129,26 +129,6 @@ module ActionView
129
129
  text.gsub(/<a.*>(.*)<\/a>/m, '\1')
130
130
  end
131
131
 
132
- # Returns a formatted-for-humans file size.
133
- #
134
- # Examples:
135
- # human_size(123) => 123 Bytes
136
- # human_size(1234) => 1.2 KB
137
- # human_size(12345) => 12.1 KB
138
- # human_size(1234567) => 1.2 MB
139
- # human_size(1234567890) => 1.1 GB
140
- def human_size(size)
141
- begin
142
- return "%d Bytes" % size if size < 1.kilobytes
143
- return "%.1f KB" % (size/1.0.kilobytes) if size < 1.megabytes
144
- return "%.1f MB" % (size/1.0.megabytes) if size < 1.gigabytes
145
- return "%.1f GB" % (size/1.0.gigabytes) if size < 1.terabytes
146
- return "%.1f TB" % (size/1.0.terabytes)
147
- rescue
148
- # just return nothing
149
- end
150
- end
151
-
152
132
  private
153
133
  # Returns a version of the text that's safe to use in a regular expression without triggering engine features.
154
134
  def escape_regexp(text)
@@ -157,7 +137,14 @@ module ActionView
157
137
 
158
138
  # Turns all urls into clickable links.
159
139
  def auto_link_urls(text)
160
- text.gsub(/([^=><!:'"\/]|^)((http[s]?:\/\/)|(www\.))(\S+\b\/?)([[:punct:]]*)(\s|$)/, '\1<a href="\3\4\5">\3\4\5</a>\6\7')
140
+ text.gsub(/(<\w+.*?>|[^=!:'"\/]|^)((?:http[s]?:\/\/)|(?:www\.))([^\s<]+\/?)([[:punct:]]|\s|<|$)/) do
141
+ all, a, b, c, d = $&, $1, $2, $3, $4
142
+ if a =~ /<a\s/i # don't replace URL's that are already linked
143
+ all
144
+ else
145
+ %(#{a}<a href="#{b=="www."?"http://www.":b}#{c}">#{b}#{c}</a>#{d})
146
+ end
147
+ end
161
148
  end
162
149
 
163
150
  # Turns all email addresses into clickable links.
@@ -99,18 +99,35 @@ module ActionView
99
99
  # link unless +name+ is specified. Additional HTML options, such as class or id, can be passed in the <tt>html_options</tt> hash.
100
100
  #
101
101
  # You can also make it difficult for spiders to harvest email address by obfuscating them.
102
- # Examples:
102
+ # Examples:
103
103
  # mail_to "me@domain.com", "My email", :encode => "javascript" # =>
104
104
  # <script type="text/javascript" language="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>
105
105
  #
106
106
  # mail_to "me@domain.com", "My email", :encode => "hex" # =>
107
107
  # <a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d">My email</a>
108
+ #
109
+ # You can also specify the cc address, bcc address, subject, and body parts of the message header to create a complex e-mail using the
110
+ # corresponding +cc+, +bcc+, +subject+, and +body+ <tt>html_options</tt> keys. Each of these options are URI escaped and then appended to
111
+ # the <tt>email_address</tt> before being output. <b>Be aware that javascript keywords will not be escaped and may break this feature
112
+ # when encoding with javascript.</b>
113
+ # Examples:
114
+ # mail_to "me@domain.com", "My email", :cc => "ccaddress@domain.com", :bcc => "bccaddress@domain.com", :subject => "This is an example email", :body => "This is the body of the message." # =>
115
+ # <a href="mailto:me@domain.com?cc="ccaddress@domain.com"&bcc="bccaddress@domain.com"&body="This%20is%20the%20body%20of%20the%20message."&subject="This%20is%20an%20example%20email">My email</a>
108
116
  def mail_to(email_address, name = nil, html_options = {})
109
117
  html_options = html_options.stringify_keys
110
118
  encode = html_options.delete("encode")
119
+ cc, bcc, subject, body = html_options.delete("cc"), html_options.delete("bcc"), html_options.delete("subject"), html_options.delete("body")
120
+
111
121
  string = ''
122
+ extras = ''
123
+ extras << "cc=#{CGI.escape(cc).gsub("+", "%20")}&" unless cc.nil?
124
+ extras << "bcc=#{CGI.escape(bcc).gsub("+", "%20")}&" unless bcc.nil?
125
+ extras << "body=#{CGI.escape(body).gsub("+", "%20")}&" unless body.nil?
126
+ extras << "subject=#{CGI.escape(subject).gsub("+", "%20")}&" unless subject.nil?
127
+ extras = "?" << extras.gsub!(/&?$/,"") unless extras.empty?
128
+
112
129
  if encode == 'javascript'
113
- tmp = "document.write('#{content_tag("a", name || email_address, html_options.merge({ "href" => "mailto:"+email_address.to_s }))}');"
130
+ tmp = "document.write('#{content_tag("a", name || email_address, html_options.merge({ "href" => "mailto:"+email_address.to_s+extras }))}');"
114
131
  for i in 0...tmp.length
115
132
  string << sprintf("%%%x",tmp[i])
116
133
  end
@@ -123,9 +140,9 @@ module ActionView
123
140
  string << email_address[i,1]
124
141
  end
125
142
  end
126
- content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{string}" })
143
+ content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{string}#{extras}" })
127
144
  else
128
- content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{email_address}" })
145
+ content_tag "a", name || email_address, html_options.merge({ "href" => "mailto:#{email_address}#{extras}" })
129
146
  end
130
147
  end
131
148
 
@@ -1,14 +1,25 @@
1
1
  module ActionView
2
2
  # There's also a convenience method for rendering sub templates within the current controller that depends on a single object
3
3
  # (we call this kind of sub templates for partials). It relies on the fact that partials should follow the naming convention of being
4
- # prefixed with an underscore -- as to separate them from regular templates that could be rendered on their own. In the template for
5
- # Advertiser#buy, we could have:
4
+ # prefixed with an underscore -- as to separate them from regular templates that could be rendered on their own.
5
+ #
6
+ # In a template for Advertiser#account:
7
+ #
8
+ # <%= render_partial "account" %>
9
+ #
10
+ # This would render "advertiser/_account.rhtml" and pass the instance variable @account in as a local variable +account+ to
11
+ # the template for display.
12
+ #
13
+ # In another template for Advertiser#buy, we could have:
14
+ #
15
+ # <%= render_partial "account", :account => @buyer %>
6
16
  #
7
17
  # <% for ad in @advertisements %>
8
- # <%= render_partial "ad", ad %>
18
+ # <%= render_partial "ad", :ad => ad %>
9
19
  # <% end %>
10
20
  #
11
- # This would render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display.
21
+ # This would first render "advertiser/_account.rhtml" with @buyer passed in as the local variable +account+, then render
22
+ # "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display.
12
23
  #
13
24
  # == Rendering a collection of partials
14
25
  #
@@ -27,15 +38,16 @@ module ActionView
27
38
  #
28
39
  # Two controllers can share a set of partials and render them like this:
29
40
  #
30
- # <%= render_partial "advertisement/ad", ad %>
41
+ # <%= render_partial "advertisement/ad", :ad => @advertisement %>
31
42
  #
32
43
  # This will render the partial "advertisement/_ad.rhtml" regardless of which controller this is being called from.
33
44
  module Partials
34
- def render_partial(partial_path, object = nil, local_assigns = {})
45
+ def render_partial(partial_path, local_assigns = {}, deprecated_local_assigns = {})
35
46
  path, partial_name = partial_pieces(partial_path)
36
- object ||= controller.instance_variable_get("@#{partial_name}")
37
- counter_name = partial_counter_name(partial_name)
38
- local_assigns = local_assigns.merge(counter_name => 1) unless local_assigns.has_key?(counter_name)
47
+ object = extracting_object(partial_name, local_assigns, deprecated_local_assigns)
48
+ local_assigns = extract_local_assigns(local_assigns, deprecated_local_assigns)
49
+ add_counter_to_local_assigns!(partial_name, local_assigns)
50
+
39
51
  render("#{path}/_#{partial_name}", { partial_name => object }.merge(local_assigns))
40
52
  end
41
53
 
@@ -69,5 +81,23 @@ module ActionView
69
81
  def partial_counter_name(partial_name)
70
82
  "#{partial_name.split('/').last}_counter"
71
83
  end
84
+
85
+ def extracting_object(partial_name, local_assigns, deprecated_local_assigns)
86
+ if local_assigns.is_a?(Hash) || local_assigns.nil?
87
+ controller.instance_variable_get("@#{partial_name}")
88
+ else
89
+ # deprecated form where object could be passed in as second parameter
90
+ local_assigns
91
+ end
92
+ end
93
+
94
+ def extract_local_assigns(local_assigns, deprecated_local_assigns)
95
+ local_assigns.is_a?(Hash) ? local_assigns : deprecated_local_assigns
96
+ end
97
+
98
+ def add_counter_to_local_assigns!(partial_name, local_assigns)
99
+ counter_name = partial_counter_name(partial_name)
100
+ local_assigns[counter_name] = 1 unless local_assigns.has_key?(counter_name)
101
+ end
72
102
  end
73
103
  end
data/rakefile CHANGED
@@ -8,7 +8,7 @@ require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10
10
  PKG_NAME = 'actionpack'
11
- PKG_VERSION = '1.7.0' + PKG_BUILD
11
+ PKG_VERSION = '1.8.0' + PKG_BUILD
12
12
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
13
 
14
14
  RELEASE_NAME = "REL #{PKG_VERSION}"
@@ -61,7 +61,7 @@ spec = Gem::Specification.new do |s|
61
61
  s.has_rdoc = true
62
62
  s.requirements << 'none'
63
63
 
64
- s.add_dependency('activesupport', '= 1.0.3' + PKG_BUILD)
64
+ s.add_dependency('activesupport', '= 1.0.4' + PKG_BUILD)
65
65
 
66
66
  s.require_path = 'lib'
67
67
  s.autorequire = 'action_controller'
@@ -80,18 +80,42 @@ Rake::GemPackageTask.new(spec) do |p|
80
80
  p.need_zip = true
81
81
  end
82
82
 
83
+ task :lines do
84
+ lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
85
+
86
+ for file_name in FileList["lib/**/*.rb"]
87
+ next if file_name =~ /vendor/
88
+ f = File.open(file_name)
89
+
90
+ while line = f.gets
91
+ lines += 1
92
+ next if line =~ /^\s*$/
93
+ next if line =~ /^\s*#/
94
+ codelines += 1
95
+ end
96
+ puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
97
+
98
+ total_lines += lines
99
+ total_codelines += codelines
100
+
101
+ lines, codelines = 0, 0
102
+ end
103
+
104
+ puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
105
+ end
106
+
83
107
 
84
108
  # Publishing ------------------------------------------------------
85
109
 
86
110
  desc "Publish the API documentation"
87
111
  task :pgem => [:package] do
88
- Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
89
- `ssh davidhh@comox.textdrive.com './gemupdate.sh'`
112
+ Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
113
+ `ssh davidhh@wrath.rubyonrails.com './gemupdate.sh'`
90
114
  end
91
115
 
92
116
  desc "Publish the API documentation"
93
117
  task :pdoc => [:rdoc] do
94
- Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ap", "doc").upload
118
+ Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.com", "public_html/ap", "doc").upload
95
119
  end
96
120
 
97
121
  desc "Publish the release files to RubyForge."
@@ -1,5 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__) + '/../lib')
2
2
  $:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
3
+ $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers')
3
4
 
4
5
  require 'test/unit'
5
6
  require 'action_controller'
@@ -170,7 +170,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase
170
170
  process :flash_me
171
171
  assert @response.has_flash_with_contents?
172
172
  assert_flash_exists
173
- assert ActionController::TestResponse.assertion_target.has_flash_with_contents?
174
173
  assert_flash_not_empty
175
174
  assert_flash_has 'hello'
176
175
  assert_flash_has_no 'stds'
@@ -385,4 +384,4 @@ class ActionPackHeaderTest < Test::Unit::TestCase
385
384
  process :hello_xml_world
386
385
  assert_equal('application/pdf', @controller.headers['Content-Type'])
387
386
  end
388
- end
387
+ end
@@ -120,7 +120,7 @@ if Object.const_defined?("ActiveRecord") || File.exist?(path_to_ar)
120
120
  end
121
121
  end
122
122
 
123
- rescue SqliteError => e
123
+ rescue Object => e
124
124
  puts "Skipping active record based tests"
125
125
  puts e.message
126
126
  end
@@ -1,4 +1,3 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
1
 
3
2
  require 'test/unit'
4
3
  require 'action_controller/cgi_ext/cgi_methods'
@@ -28,6 +28,11 @@ class CookieTest < Test::Unit::TestCase
28
28
  render_text "hello world"
29
29
  end
30
30
 
31
+ def access_frozen_cookies
32
+ @cookies["will"] = "work"
33
+ render_text "hello world"
34
+ end
35
+
31
36
  def rescue_action(e) raise end
32
37
  end
33
38
 
@@ -63,8 +68,13 @@ class CookieTest < Test::Unit::TestCase
63
68
  assert_equal 2, process_request.headers["cookie"].size
64
69
  end
65
70
 
71
+ def test_setting_test_cookie
72
+ @request.action = "access_frozen_cookies"
73
+ assert_nothing_raised { process_request }
74
+ end
75
+
66
76
  private
67
77
  def process_request
68
78
  TestController.process(@request, @response)
69
79
  end
70
- end
80
+ end
@@ -1,5 +1,4 @@
1
1
  require File.dirname(__FILE__) + '/../abstract_unit'
2
- $:.unshift(File.dirname(__FILE__) + '/../fixtures/helpers')
3
2
 
4
3
  class TestController < ActionController::Base
5
4
  attr_accessor :delegate_attr
@@ -24,7 +23,6 @@ module LocalAbcHelper
24
23
  end
25
24
 
26
25
  class HelperTest < Test::Unit::TestCase
27
- HELPER_PATHS = %w(/../fixtures/helpers)
28
26
 
29
27
  def setup
30
28
  # Increment symbol counter.
@@ -41,11 +39,6 @@ class HelperTest < Test::Unit::TestCase
41
39
  @template_class = self.class.const_get(template_class_name)
42
40
  @controller_class.template_class = @template_class
43
41
 
44
- # Add helper paths to LOAD_PATH.
45
- HELPER_PATHS.each { |path|
46
- $LOAD_PATH.unshift(File.dirname(__FILE__) + path)
47
- }
48
-
49
42
  # Set default test helper.
50
43
  self.test_helper = LocalAbcHelper
51
44
  end
@@ -53,11 +46,6 @@ class HelperTest < Test::Unit::TestCase
53
46
  def teardown
54
47
  # Reset template class.
55
48
  #ActionController::Base.template_class = ActionView::Base
56
-
57
- # Remove helper paths from LOAD_PATH.
58
- HELPER_PATHS.each { |path|
59
- $LOAD_PATH.delete(File.dirname(__FILE__) + path)
60
- }
61
49
  end
62
50
 
63
51