提交 9ccbb135 编写于 作者: J Jeremy Kemper

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
上级 33e9876c
......@@ -93,7 +93,7 @@ def load_rubygems
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 @@ def test_should_return_nil_if_no_lines_are_passed
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册