Permalink
Browse files

Eliminate a "string literal in condition" warning from some routes

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1502 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent ebb6fb0 commit 17928b73473c0e15d51969a1426253b70af9eb09 @jamis jamis committed Jun 25, 2005
Showing with 13 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/code_generation.rb
  2. +12 −0 actionpack/test/controller/routing_test.rb
@@ -187,7 +187,7 @@ def hash_value(key, assign = true, default = nil)
locals << local_name(key)
end
end
- code = "(#{code} || #{default.inspect})" if default
+ code = "(#{code} || (#{default.inspect}))" if default
return code
end
@@ -1,5 +1,6 @@
require File.dirname(__FILE__) + '/../abstract_unit'
require 'test/unit'
+require 'stringio'
RunTimeTests = ARGV.include? 'time'
@@ -629,6 +630,17 @@ def test_route_with_colon_first
end
end
+ def test_route_generating_string_literal_in_comparison_warning
+ old_stderr = $stderr
+ $stderr = StringIO.new
+ rs.draw do |map|
+ map.connect 'subscriptions/:action/:subscription_type', :controller => "subscriptions"
+ end
+ assert_equal "", $stderr.string
+ ensure
+ $stderr = old_stderr
+ end
+
def test_basic_named_route
rs.home '', :controller => 'content', :action => 'list'
x = setup_for_named_route

0 comments on commit 17928b7

Please sign in to comment.