Permalink
Browse files

Merge commit 'mainstream/master'

  • Loading branch information...
2 parents 0fc3381 + 46f30f9 commit 17c8cba3a04d715e1063e5adea2b22abce417527 @lifo lifo committed May 16, 2008
@@ -249,7 +249,7 @@ def interpolation_chunk(value_code = "#{local_name}")
end
def extract_value
- "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
+ "#{local_name} = hash[:#{key}] && hash[:#{key}].collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
end
def default
@@ -454,7 +454,7 @@ def set_cycle(name, cycle_object)
( # leading text
<\w+.*?>| # leading HTML tag, or
[^=!:'"/]| # leading punctuation, or
- ^ # beginning of line
+ | # nothing
)
(
(?:https?://)| # protocol spec, or
@@ -50,6 +50,13 @@ def test_route_recognition_unescapes_path_components
:additional => ["add#{@segment}itional-1", "add#{@segment}itional-2"] }
assert_equal options, @set.recognize_path("/controller/act#{@escaped}ion/var#{@escaped}iable/add#{@escaped}itional-1/add#{@escaped}itional-2")
end
+
+ def test_route_generation_allows_passing_non_string_values_to_generated_helper
+ assert_equal "/controller/action/variable/1/2", @set.generate(:controller => "controller",
+ :action => "action",
+ :variable => "variable",
+ :additional => [1, 2])
+ end
end
class LegacyRouteSetTests < Test::Unit::TestCase
@@ -262,6 +262,7 @@ def test_auto_linking
assert_equal email2_result, auto_link(email2_raw)
assert_equal '', auto_link(nil)
assert_equal '', auto_link('')
+ assert_equal "#{link_result} #{link_result} #{link_result}", auto_link("#{link_raw} #{link_raw} #{link_raw}")
end
def test_auto_link_at_eol
View
@@ -1,4 +1,16 @@
#!/usr/bin/env ruby
$LOAD_PATH << File.join(File.dirname(__FILE__), 'vendor', 'rspec', 'lib')
require 'rake'
-require 'spec/rake/spectask'
+require 'spec/rake/spectask'
+require 'rake/rdoctask'
+
+# Generate the RDoc documentation
+Rake::RDocTask.new { |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "Active Model"
+ rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
+ rdoc.options << '--charset' << 'utf-8'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.rdoc_files.include('README', 'CHANGES')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+}
@@ -6,7 +6,7 @@
require 'models/author'
class NamedScopeTest < ActiveRecord::TestCase
- fixtures :posts, :authors, :topics
+ fixtures :posts, :authors, :topics, :comments
def test_implements_enumerable
assert !Topic.find(:all).empty?
@@ -95,7 +95,7 @@ def test_has_many_associations_have_access_to_named_scopes
end
def test_has_many_through_associations_have_access_to_named_scopes
- assert_not_equal Comment.containing_the_letter_e, authors(:david).posts
+ assert_not_equal Comment.containing_the_letter_e, authors(:david).comments
assert !Comment.containing_the_letter_e.empty?
assert_equal authors(:david).comments & Comment.containing_the_letter_e, authors(:david).comments.containing_the_letter_e
@@ -40,10 +40,11 @@ def find_cmd(*commands)
exec(find_cmd('mysql5', 'mysql'), *args)
when "postgresql"
+ ENV['PGUSER'] = config["username"] if config["username"]
ENV['PGHOST'] = config["host"] if config["host"]
ENV['PGPORT'] = config["port"].to_s if config["port"]
ENV['PGPASSWORD'] = config["password"].to_s if config["password"]
- exec(find_cmd('psql'), '-U', config["username"], config["database"])
+ exec(find_cmd('psql'), config["database"])
when "sqlite"
exec(find_cmd('sqlite'), config["database"])

0 comments on commit 17c8cba

Please sign in to comment.