1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow double quotes around RAILS_GEM_VERSION also. Closes #10443 [James Cox]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8358 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2007-12-10 03:19:27 +00:00
parent 33e9876c00
commit 9ccbb13563
2 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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