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:
parent
33e9876c00
commit
9ccbb13563
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue