aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/environments/boot.rb2
-rw-r--r--railties/test/boot_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/railties/environments/boot.rb b/railties/environments/boot.rb
index b71c198db3..1e9f1b109d 100644
--- a/railties/environments/boot.rb
+++ b/railties/environments/boot.rb
@@ -93,7 +93,7 @@ module Rails
end
def parse_gem_version(text)
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end
private
diff --git a/railties/test/boot_test.rb b/railties/test/boot_test.rb
index 375ce52e31..36fae307ca 100644
--- a/railties/test/boot_test.rb
+++ b/railties/test/boot_test.rb
@@ -128,6 +128,11 @@ class ParseGemVersionTest < Test::Unit::TestCase
assert_equal nil, parse(nil)
end
+ def test_should_accept_either_single_or_double_quotes
+ assert_equal "1.2.3", parse("RAILS_GEM_VERSION = '1.2.3'")
+ assert_equal "1.2.3", parse('RAILS_GEM_VERSION = "1.2.3"')
+ end
+
def test_should_return_nil_if_no_lines_match
assert_equal nil, parse('nothing matches on this line\nor on this line')
end