actionpack 1.1.0 → 1.2.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.
- data/CHANGELOG +24 -0
- data/install.rb +9 -0
- data/lib/action_controller.rb +1 -0
- data/lib/action_controller/base.rb +7 -4
- data/lib/action_controller/{support → cgi_ext}/cookie_performance_fix.rb +0 -0
- data/lib/action_controller/cgi_process.rb +1 -1
- data/lib/action_controller/dependencies.rb +0 -19
- data/lib/action_controller/helpers.rb +1 -1
- data/lib/action_controller/layout.rb +16 -0
- data/lib/action_controller/response.rb +4 -2
- data/lib/action_controller/session/drb_server.rb +24 -1
- data/lib/action_controller/session/mem_cache_store.rb +95 -0
- data/lib/action_controller/support/binding_of_caller.rb +81 -0
- data/lib/action_controller/support/breakpoint.rb +525 -0
- data/lib/action_controller/support/dependencies.rb +71 -0
- data/lib/action_controller/support/misc.rb +29 -3
- data/lib/action_controller/support/module_attribute_accessors.rb +57 -0
- data/lib/action_controller/test_process.rb +20 -4
- data/lib/action_controller/url_rewriter.rb +4 -4
- data/lib/action_view/helpers/date_helper.rb +20 -0
- data/rakefile +5 -5
- data/test/controller/url_test.rb +31 -0
- data/test/template/date_helper_test.rb +54 -1
- data/test/template/url_helper_test.rb +1 -2
- metadata +15 -7
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/module_attribute_accessors'
|
2
|
+
|
3
|
+
module Dependencies
|
4
|
+
extend self
|
5
|
+
|
6
|
+
@@loaded = [ ]
|
7
|
+
mattr_accessor :loaded
|
8
|
+
|
9
|
+
@@mechanism = :load
|
10
|
+
mattr_accessor :mechanism
|
11
|
+
|
12
|
+
def depend_on(file_name, swallow_load_errors = false)
|
13
|
+
if !loaded.include?(file_name)
|
14
|
+
loaded << file_name
|
15
|
+
|
16
|
+
begin
|
17
|
+
require_or_load(file_name)
|
18
|
+
rescue LoadError
|
19
|
+
raise unless swallow_load_errors
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def associate_with(file_name)
|
25
|
+
depend_on(file_name, true)
|
26
|
+
end
|
27
|
+
|
28
|
+
def reload
|
29
|
+
old_loaded = loaded
|
30
|
+
clear
|
31
|
+
|
32
|
+
old_loaded.each do |file_name|
|
33
|
+
begin
|
34
|
+
silence_warnings { load("#{file_name}.rb") }
|
35
|
+
rescue LoadError
|
36
|
+
# The association didn't reside in its own file, so we assume it was required by other means
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def clear
|
42
|
+
self.loaded = [ ]
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def require_or_load(file_name)
|
47
|
+
mechanism == :load ? silence_warnings { load("#{file_name}.rb") } : require(file_name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Object.send(:define_method, :require_dependency) { |file_name| Dependencies.depend_on(file_name) } unless Object.respond_to?(:require_dependency)
|
52
|
+
Object.send(:define_method, :require_association) { |file_name| Dependencies.associate_with(file_name) } unless Object.respond_to?(:require_association)
|
53
|
+
|
54
|
+
class Object
|
55
|
+
class << self
|
56
|
+
# Use const_missing to autoload associations so we don't have to
|
57
|
+
# require_association when using single-table inheritance.
|
58
|
+
unless respond_to?(:pre_dependency_const_missing)
|
59
|
+
alias_method :pre_dependency_const_missing, :const_missing
|
60
|
+
|
61
|
+
def const_missing(class_id)
|
62
|
+
begin
|
63
|
+
require_dependency(Inflector.underscore(Inflector.demodulize(class_id.to_s)))
|
64
|
+
return Object.const_get(class_id) if Object.const_defined?(class_id)
|
65
|
+
rescue LoadError
|
66
|
+
pre_dependency_const_missing(class_id)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -1,6 +1,32 @@
|
|
1
1
|
def silence_warnings
|
2
2
|
old_verbose, $VERBOSE = $VERBOSE, nil
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
begin
|
4
|
+
yield
|
5
|
+
ensure
|
6
|
+
$VERBOSE = old_verbose
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Hash
|
11
|
+
# Return a new hash with all keys converted to symbols.
|
12
|
+
def symbolize_keys
|
13
|
+
inject({}) do |options, (key, value)|
|
14
|
+
options[key.to_sym] = value
|
15
|
+
options
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Destructively convert all keys to symbols.
|
20
|
+
def symbolize_keys!
|
21
|
+
keys.each do |key|
|
22
|
+
unless key.is_a?(Symbol)
|
23
|
+
self[key.to_sym] = self[key]
|
24
|
+
delete(key)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
|
30
|
+
alias_method :to_options, :symbolize_keys
|
31
|
+
alias_method :to_options!, :symbolize_keys!
|
6
32
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Extends the module object with module and instance accessors for class attributes,
|
2
|
+
# just like the native attr* accessors for instance attributes.
|
3
|
+
class Module # :nodoc:
|
4
|
+
def mattr_reader(*syms)
|
5
|
+
syms.each do |sym|
|
6
|
+
class_eval <<-EOS
|
7
|
+
if ! defined? @@#{sym.id2name}
|
8
|
+
@@#{sym.id2name} = nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.#{sym.id2name}
|
12
|
+
@@#{sym}
|
13
|
+
end
|
14
|
+
|
15
|
+
def #{sym.id2name}
|
16
|
+
@@#{sym}
|
17
|
+
end
|
18
|
+
|
19
|
+
def call_#{sym.id2name}
|
20
|
+
case @@#{sym.id2name}
|
21
|
+
when Symbol then send(@@#{sym})
|
22
|
+
when Proc then @@#{sym}.call(self)
|
23
|
+
when String then @@#{sym}
|
24
|
+
else nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
EOS
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def mattr_writer(*syms)
|
32
|
+
syms.each do |sym|
|
33
|
+
class_eval <<-EOS
|
34
|
+
if ! defined? @@#{sym.id2name}
|
35
|
+
@@#{sym.id2name} = nil
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.#{sym.id2name}=(obj)
|
39
|
+
@@#{sym.id2name} = obj
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.set_#{sym.id2name}(obj)
|
43
|
+
@@#{sym.id2name} = obj
|
44
|
+
end
|
45
|
+
|
46
|
+
def #{sym.id2name}=(obj)
|
47
|
+
@@#{sym} = obj
|
48
|
+
end
|
49
|
+
EOS
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def mattr_accessor(*syms)
|
54
|
+
mattr_reader(*syms)
|
55
|
+
mattr_writer(*syms)
|
56
|
+
end
|
57
|
+
end
|
@@ -1,6 +1,22 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/assertions/action_pack_assertions'
|
2
2
|
require File.dirname(__FILE__) + '/assertions/active_record_assertions'
|
3
3
|
|
4
|
+
if defined?(RAILS_ROOT)
|
5
|
+
# Temporary hack for getting functional tests in Rails running under 1.8.2
|
6
|
+
class Object #:nodoc:
|
7
|
+
alias_method :require_without_load_path_reloading, :require
|
8
|
+
def require(file_name)
|
9
|
+
begin
|
10
|
+
require_without_load_path_reloading(file_name)
|
11
|
+
rescue Object => e
|
12
|
+
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) }
|
13
|
+
require_without_load_path_reloading(file_name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
4
20
|
module ActionController #:nodoc:
|
5
21
|
class Base
|
6
22
|
# Process a test request called with a +TestRequest+ object.
|
@@ -57,10 +73,10 @@ module ActionController #:nodoc:
|
|
57
73
|
end
|
58
74
|
|
59
75
|
def initialize_default_values
|
60
|
-
@host
|
61
|
-
@request_uri
|
62
|
-
@remote_addr
|
63
|
-
@env["SERVER_PORT"]
|
76
|
+
@host = "test.host"
|
77
|
+
@request_uri = "/"
|
78
|
+
@remote_addr, @remote_ip = "127.0.0.1"
|
79
|
+
@env["SERVER_PORT"] = 80
|
64
80
|
end
|
65
81
|
end
|
66
82
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActionController
|
2
2
|
# Rewrites urls for Base.redirect_to and Base.url_for in the controller.
|
3
3
|
class UrlRewriter #:nodoc:
|
4
|
-
VALID_OPTIONS = [:action, :action_prefix, :action_suffix, :module, :controller, :controller_prefix, :anchor, :params, :path_params, :id, :only_path, :overwrite_params ]
|
4
|
+
VALID_OPTIONS = [:action, :action_prefix, :action_suffix, :module, :controller, :controller_prefix, :anchor, :params, :path_params, :id, :only_path, :overwrite_params, :host, :protocol ]
|
5
5
|
|
6
6
|
def initialize(request, controller, action)
|
7
7
|
@request, @controller, @action = request, controller, action
|
@@ -38,8 +38,8 @@ module ActionController
|
|
38
38
|
|
39
39
|
def rewrite_url(path, options)
|
40
40
|
rewritten_url = ""
|
41
|
-
rewritten_url << @request.protocol unless options[:only_path]
|
42
|
-
rewritten_url << @request.host_with_port unless options[:only_path]
|
41
|
+
rewritten_url << (options[:protocol] || @request.protocol) unless options[:only_path]
|
42
|
+
rewritten_url << (options[:host] || @request.host_with_port) unless options[:only_path]
|
43
43
|
|
44
44
|
rewritten_url << path
|
45
45
|
rewritten_url << build_query_string(new_parameters(options)) if options[:params] || options[:overwrite_params]
|
@@ -91,7 +91,7 @@ module ActionController
|
|
91
91
|
path = path.sub(%r(#{@controller}/?), @controller + "/" + action_name(options)) # " ruby-mode
|
92
92
|
end
|
93
93
|
else
|
94
|
-
path = path.sub((action_prefix || "") + @action + (action_suffix || ""), action_name(options, action_prefix))
|
94
|
+
path = path.sub(@controller + "/" + (action_prefix || "") + @action + (action_suffix || ""), @controller + "/" + action_name(options, action_prefix))
|
95
95
|
end
|
96
96
|
|
97
97
|
if options[:controller_prefix] && !options[:controller]
|
@@ -76,6 +76,26 @@ module ActionView
|
|
76
76
|
select_hour(datetime, options) + select_minute(datetime, options)
|
77
77
|
end
|
78
78
|
|
79
|
+
# Returns a set of html select-tags (one for hour and minute)
|
80
|
+
def select_time(datetime = Time.now, options = {})
|
81
|
+
h = select_hour(datetime, options) + select_minute(datetime, options) + (options[:include_seconds] ? select_second(datetime, options) : '')
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns a select tag with options for each of the seconds 0 through 59 with the current second selected.
|
85
|
+
# The <tt>second</tt> can also be substituted for a second number.
|
86
|
+
def select_second(datetime, options = {})
|
87
|
+
second_options = []
|
88
|
+
|
89
|
+
0.upto(59) do |second|
|
90
|
+
second_options << ((datetime.kind_of?(Fixnum) ? datetime : datetime.sec) == second ?
|
91
|
+
"<option selected=\"selected\">#{leading_zero_on_single_digits(second)}</option>\n" :
|
92
|
+
"<option>#{leading_zero_on_single_digits(second)}</option>\n"
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
96
|
+
select_html("second", second_options, options[:prefix], options[:include_blank], options[:discard_type])
|
97
|
+
end
|
98
|
+
|
79
99
|
# Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected.
|
80
100
|
# The <tt>minute</tt> can also be substituted for a minute number.
|
81
101
|
def select_minute(datetime, options = {})
|
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.
|
11
|
+
PKG_VERSION = '1.2.0' + PKG_BUILD
|
12
12
|
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
13
13
|
|
14
14
|
desc "Default Task"
|
@@ -49,7 +49,7 @@ spec = Gem::Specification.new do |s|
|
|
49
49
|
s.author = "David Heinemeier Hansson"
|
50
50
|
s.email = "david@loudthinking.com"
|
51
51
|
s.rubyforge_project = "actionpack"
|
52
|
-
s.homepage = "http://
|
52
|
+
s.homepage = "http://www.rubyonrails.org"
|
53
53
|
|
54
54
|
s.has_rdoc = true
|
55
55
|
s.requirements << 'none'
|
@@ -74,14 +74,14 @@ end
|
|
74
74
|
# Publish beta gem
|
75
75
|
desc "Publish the API documentation"
|
76
76
|
task :pgem => [:package] do
|
77
|
-
Rake::SshFilePublisher.new("davidhh@
|
78
|
-
`ssh davidhh@
|
77
|
+
Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
78
|
+
`ssh davidhh@comox.textdrive.com './gemupdate.sh'`
|
79
79
|
end
|
80
80
|
|
81
81
|
# Publish documentation
|
82
82
|
desc "Publish the API documentation"
|
83
83
|
task :pdoc => [:rdoc] do
|
84
|
-
Rake::SshDirPublisher.new("davidhh@
|
84
|
+
Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ap", "doc").upload
|
85
85
|
end
|
86
86
|
|
87
87
|
|
data/test/controller/url_test.rb
CHANGED
@@ -51,6 +51,14 @@ class UrlTest < Test::Unit::TestCase
|
|
51
51
|
"http://", "www.singlefile.com", 80, "/identity/show/5", { "id" => "5" }
|
52
52
|
), "identity", "show")
|
53
53
|
|
54
|
+
@clean_url_with_same_action_and_controller_name = ActionController::UrlRewriter.new(MockRequest.new(
|
55
|
+
"http://", "www.singlefile.com", 80, "/login/login", { }
|
56
|
+
), "login", "login")
|
57
|
+
|
58
|
+
@clean_url_with_same_action_and_controller_and_module_name = ActionController::UrlRewriter.new(MockRequest.new(
|
59
|
+
"http://", "www.singlefile.com", 80, "/login/login/login", { "module" => "login" }
|
60
|
+
), "login", "login")
|
61
|
+
|
54
62
|
@clean_url_with_id_as_char = ActionController::UrlRewriter.new(MockRequest.new(
|
55
63
|
"http://", "www.singlefile.com", 80, "/teachers/show/t", { "id" => "t" }
|
56
64
|
), "teachers", "show")
|
@@ -60,6 +68,20 @@ class UrlTest < Test::Unit::TestCase
|
|
60
68
|
assert_equal "http://www.singlefile.com/library/books/ISBN/0743536703/edit", @library_url.rewrite(:action => "edit")
|
61
69
|
end
|
62
70
|
|
71
|
+
def test_clean_action_to_another_host
|
72
|
+
assert_equal(
|
73
|
+
"http://www.booksphere.com/library/books/ISBN/0743536703/edit",
|
74
|
+
@library_url.rewrite(:action => "edit", :host => "www.booksphere.com")
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_clean_action_to_another_host_and_protocol
|
79
|
+
assert_equal(
|
80
|
+
"https://www.booksphere.com/library/books/ISBN/0743536703/edit",
|
81
|
+
@library_url.rewrite(:action => "edit", :host => "www.booksphere.com", :protocol => "https://")
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
63
85
|
def test_clean_action_with_only_path
|
64
86
|
assert_equal "/library/books/ISBN/0743536703/edit", @library_url.rewrite(:action => "edit", :only_path => true)
|
65
87
|
end
|
@@ -165,6 +187,15 @@ class UrlTest < Test::Unit::TestCase
|
|
165
187
|
assert_equal "http://www.singlefile.com/library/settings/", @library_url.rewrite(:controller => "settings", :action => "index")
|
166
188
|
end
|
167
189
|
|
190
|
+
def test_same_controller_and_action_names
|
191
|
+
assert_equal "http://www.singlefile.com/login/logout", @clean_url_with_same_action_and_controller_name.rewrite(:action => "logout")
|
192
|
+
end
|
193
|
+
|
194
|
+
# FIXME
|
195
|
+
def xtest_same_module_and_controller_and_action_names
|
196
|
+
assert_equal "http://www.singlefile.com/login/login/logout", @clean_url_with_same_action_and_controller_and_module_name.rewrite(:action => "logout")
|
197
|
+
end
|
198
|
+
|
168
199
|
def test_controller_and_action_with_same_name_as_controller
|
169
200
|
@clean_urls.each do |url|
|
170
201
|
assert_equal "http://www.singlefile.com/anything/identity", url.rewrite(:controller => "anything", :action => "identity")
|
@@ -81,6 +81,30 @@ class DateHelperTest < Test::Unit::TestCase
|
|
81
81
|
assert_equal expected, select_year(
|
82
82
|
2003, :prefix => "date_year", :discard_type => true, :start_year => 2003, :end_year => 2005)
|
83
83
|
end
|
84
|
+
|
85
|
+
def test_select_hour
|
86
|
+
expected = %(<select name="date[hour]">\n)
|
87
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option>04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option selected="selected">08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n)
|
88
|
+
expected << "</select>\n"
|
89
|
+
|
90
|
+
assert_equal expected, select_hour(Time.mktime(2003, 8, 16, 8, 4, 18))
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_select_minute
|
94
|
+
expected = %(<select name="date[minute]">\n)
|
95
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option selected="selected">04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option>08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n<option>24</option>\n<option>25</option>\n<option>26</option>\n<option>27</option>\n<option>28</option>\n<option>29</option>\n<option>30</option>\n<option>31</option>\n<option>32</option>\n<option>33</option>\n<option>34</option>\n<option>35</option>\n<option>36</option>\n<option>37</option>\n<option>38</option>\n<option>39</option>\n<option>40</option>\n<option>41</option>\n<option>42</option>\n<option>43</option>\n<option>44</option>\n<option>45</option>\n<option>46</option>\n<option>47</option>\n<option>48</option>\n<option>49</option>\n<option>50</option>\n<option>51</option>\n<option>52</option>\n<option>53</option>\n<option>54</option>\n<option>55</option>\n<option>56</option>\n<option>57</option>\n<option>58</option>\n<option>59</option>\n)
|
96
|
+
expected << "</select>\n"
|
97
|
+
|
98
|
+
assert_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18))
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_select_second
|
102
|
+
expected = %(<select name="date[second]">\n)
|
103
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option>04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option>08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option selected="selected">18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n<option>24</option>\n<option>25</option>\n<option>26</option>\n<option>27</option>\n<option>28</option>\n<option>29</option>\n<option>30</option>\n<option>31</option>\n<option>32</option>\n<option>33</option>\n<option>34</option>\n<option>35</option>\n<option>36</option>\n<option>37</option>\n<option>38</option>\n<option>39</option>\n<option>40</option>\n<option>41</option>\n<option>42</option>\n<option>43</option>\n<option>44</option>\n<option>45</option>\n<option>46</option>\n<option>47</option>\n<option>48</option>\n<option>49</option>\n<option>50</option>\n<option>51</option>\n<option>52</option>\n<option>53</option>\n<option>54</option>\n<option>55</option>\n<option>56</option>\n<option>57</option>\n<option>58</option>\n<option>59</option>\n)
|
104
|
+
expected << "</select>\n"
|
105
|
+
|
106
|
+
assert_equal expected, select_second(Time.mktime(2003, 8, 16, 8, 4, 18))
|
107
|
+
end
|
84
108
|
|
85
109
|
|
86
110
|
def test_select_date
|
@@ -177,6 +201,35 @@ class DateHelperTest < Test::Unit::TestCase
|
|
177
201
|
)
|
178
202
|
end
|
179
203
|
|
204
|
+
def test_select_time_with_seconds
|
205
|
+
expected = %(<select name="date[hour]">\n)
|
206
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option>04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option selected="selected">08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n)
|
207
|
+
expected << "</select>\n"
|
208
|
+
|
209
|
+
expected << %(<select name="date[minute]">\n)
|
210
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option selected="selected">04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option>08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n<option>24</option>\n<option>25</option>\n<option>26</option>\n<option>27</option>\n<option>28</option>\n<option>29</option>\n<option>30</option>\n<option>31</option>\n<option>32</option>\n<option>33</option>\n<option>34</option>\n<option>35</option>\n<option>36</option>\n<option>37</option>\n<option>38</option>\n<option>39</option>\n<option>40</option>\n<option>41</option>\n<option>42</option>\n<option>43</option>\n<option>44</option>\n<option>45</option>\n<option>46</option>\n<option>47</option>\n<option>48</option>\n<option>49</option>\n<option>50</option>\n<option>51</option>\n<option>52</option>\n<option>53</option>\n<option>54</option>\n<option>55</option>\n<option>56</option>\n<option>57</option>\n<option>58</option>\n<option>59</option>\n)
|
211
|
+
expected << "</select>\n"
|
212
|
+
|
213
|
+
expected << %(<select name="date[second]">\n)
|
214
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option>04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option>08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option selected="selected">18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n<option>24</option>\n<option>25</option>\n<option>26</option>\n<option>27</option>\n<option>28</option>\n<option>29</option>\n<option>30</option>\n<option>31</option>\n<option>32</option>\n<option>33</option>\n<option>34</option>\n<option>35</option>\n<option>36</option>\n<option>37</option>\n<option>38</option>\n<option>39</option>\n<option>40</option>\n<option>41</option>\n<option>42</option>\n<option>43</option>\n<option>44</option>\n<option>45</option>\n<option>46</option>\n<option>47</option>\n<option>48</option>\n<option>49</option>\n<option>50</option>\n<option>51</option>\n<option>52</option>\n<option>53</option>\n<option>54</option>\n<option>55</option>\n<option>56</option>\n<option>57</option>\n<option>58</option>\n<option>59</option>\n)
|
215
|
+
expected << "</select>\n"
|
216
|
+
|
217
|
+
assert_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => true)
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_select_time_without_seconds
|
221
|
+
expected = %(<select name="date[hour]">\n)
|
222
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option>04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option selected="selected">08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n)
|
223
|
+
expected << "</select>\n"
|
224
|
+
|
225
|
+
expected << %(<select name="date[minute]">\n)
|
226
|
+
expected << %(<option>00</option>\n<option>01</option>\n<option>02</option>\n<option>03</option>\n<option selected="selected">04</option>\n<option>05</option>\n<option>06</option>\n<option>07</option>\n<option>08</option>\n<option>09</option>\n<option>10</option>\n<option>11</option>\n<option>12</option>\n<option>13</option>\n<option>14</option>\n<option>15</option>\n<option>16</option>\n<option>17</option>\n<option>18</option>\n<option>19</option>\n<option>20</option>\n<option>21</option>\n<option>22</option>\n<option>23</option>\n<option>24</option>\n<option>25</option>\n<option>26</option>\n<option>27</option>\n<option>28</option>\n<option>29</option>\n<option>30</option>\n<option>31</option>\n<option>32</option>\n<option>33</option>\n<option>34</option>\n<option>35</option>\n<option>36</option>\n<option>37</option>\n<option>38</option>\n<option>39</option>\n<option>40</option>\n<option>41</option>\n<option>42</option>\n<option>43</option>\n<option>44</option>\n<option>45</option>\n<option>46</option>\n<option>47</option>\n<option>48</option>\n<option>49</option>\n<option>50</option>\n<option>51</option>\n<option>52</option>\n<option>53</option>\n<option>54</option>\n<option>55</option>\n<option>56</option>\n<option>57</option>\n<option>58</option>\n<option>59</option>\n)
|
227
|
+
expected << "</select>\n"
|
228
|
+
|
229
|
+
assert_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18))
|
230
|
+
assert_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), :include_seconds => false)
|
231
|
+
end
|
232
|
+
|
180
233
|
def test_date_select_with_zero_value
|
181
234
|
expected = %(<select name="date[first][year]">\n)
|
182
235
|
expected << %(<option>2003</option>\n<option>2004</option>\n<option>2005</option>\n)
|
@@ -213,7 +266,7 @@ class DateHelperTest < Test::Unit::TestCase
|
|
213
266
|
|
214
267
|
def test_date_select_with_zero_value_and_no_end_year
|
215
268
|
expected = %(<select name="date[first][year]">\n)
|
216
|
-
2003.upto(
|
269
|
+
2003.upto(2010) { |y| expected << %(<option>#{y}</option>\n) }
|
217
270
|
expected << "</select>\n"
|
218
271
|
|
219
272
|
expected << %(<select name="date[first][month]">\n)
|
@@ -58,7 +58,6 @@ class UrlHelperTest < Test::Unit::TestCase
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_link_with_nil_html_options
|
61
|
-
|
62
|
-
link_to("Hello", {:action => 'myaction'}, nil)
|
61
|
+
assert_equal "<a href=\"http://www.world.com\">Hello</a>", link_to("Hello", {:action => 'myaction'}, nil)
|
63
62
|
end
|
64
63
|
end
|
metadata
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.4
|
3
3
|
specification_version: 1
|
4
4
|
name: actionpack
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
date:
|
6
|
+
version: 1.2.0
|
7
|
+
date: 2005-01-04
|
8
8
|
summary: Web-flow and rendering framework putting the VC in MVC.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
author: David Heinemeier Hansson
|
12
11
|
email: david@loudthinking.com
|
13
|
-
homepage: http://
|
12
|
+
homepage: http://www.rubyonrails.org
|
14
13
|
rubyforge_project: actionpack
|
15
|
-
description: "Eases web-request routing, handling, and response as a half-way front, half-way
|
14
|
+
description: "Eases web-request routing, handling, and response as a half-way front, half-way
|
15
|
+
page controller. Implemented with specific emphasis on enabling easy
|
16
|
+
unit/integration testing that doesn't require a browser."
|
16
17
|
autorequire: action_controller
|
17
18
|
default_executable:
|
18
19
|
bindir: bin
|
@@ -25,6 +26,8 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
26
|
version: 0.0.0
|
26
27
|
version:
|
27
28
|
platform: ruby
|
29
|
+
authors:
|
30
|
+
- David Heinemeier Hansson
|
28
31
|
files:
|
29
32
|
- rakefile
|
30
33
|
- install.rb
|
@@ -62,15 +65,20 @@ files:
|
|
62
65
|
- lib/action_controller/assertions/active_record_assertions.rb
|
63
66
|
- lib/action_controller/cgi_ext/cgi_ext.rb
|
64
67
|
- lib/action_controller/cgi_ext/cgi_methods.rb
|
68
|
+
- lib/action_controller/cgi_ext/cookie_performance_fix.rb
|
65
69
|
- lib/action_controller/session/active_record_store.rb
|
66
70
|
- lib/action_controller/session/drb_server.rb
|
67
71
|
- lib/action_controller/session/drb_store.rb
|
72
|
+
- lib/action_controller/session/mem_cache_store.rb
|
73
|
+
- lib/action_controller/support/binding_of_caller.rb
|
74
|
+
- lib/action_controller/support/breakpoint.rb
|
68
75
|
- lib/action_controller/support/class_attribute_accessors.rb
|
69
76
|
- lib/action_controller/support/class_inheritable_attributes.rb
|
70
77
|
- lib/action_controller/support/clean_logger.rb
|
71
|
-
- lib/action_controller/support/
|
78
|
+
- lib/action_controller/support/dependencies.rb
|
72
79
|
- lib/action_controller/support/inflector.rb
|
73
80
|
- lib/action_controller/support/misc.rb
|
81
|
+
- lib/action_controller/support/module_attribute_accessors.rb
|
74
82
|
- lib/action_controller/templates/rescues
|
75
83
|
- lib/action_controller/templates/scaffolds
|
76
84
|
- lib/action_controller/templates/rescues/_request_and_response.rhtml
|