File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -42,16 +42,16 @@ def ruby(*ruby_version)
4242 # Loads the file relative to the dirname of the Gemfile itself.
4343 def normalize_ruby_file ( filename )
4444 file_content = Bundler . read_file ( gemfile . dirname . join ( filename ) )
45- # match "ruby-3.2.2", ruby = "3.2.2" or "ruby 3.2.2" capturing version string up to the first space or comment
45+ # match "ruby-3.2.2", ruby = "3.2.2", ruby = '3.2.2' or "ruby 3.2.2" capturing version string up to the first space or comment
4646 if /^ # Start of line
4747 ruby # Literal "ruby"
4848 [\s -]* # Optional whitespace or hyphens (for "ruby-3.2.2" format)
4949 (?:=\s *)? # Optional equals sign with whitespace (for ruby = "3.2.2" format)
50- "? # Optional opening quote
50+ ["']? # Optional opening quote
5151 ( # Start capturing group
52- [^\s #"]+ # One or more chars that aren't spaces, #, or quotes
52+ [^\s #"']+ # One or more chars that aren't spaces, #, or quotes
5353 ) # End capturing group
54- "? # Optional closing quote
54+ ["']? # Optional closing quote
5555 /x . match ( file_content )
5656 $1
5757 else
Original file line number Diff line number Diff line change @@ -178,11 +178,21 @@ class MockDSL
178178 let ( :file_content ) do
179179 <<~TOML
180180 [tools]
181- ruby = " #{ version } "
181+ ruby = #{ quote } #{ version } #{ quote }
182182 TOML
183183 end
184184
185- it_behaves_like "it stores the ruby version"
185+ context "with double quotes" do
186+ let ( :quote ) { '"' }
187+
188+ it_behaves_like "it stores the ruby version"
189+ end
190+
191+ context "with single quotes" do
192+ let ( :quote ) { "'" }
193+
194+ it_behaves_like "it stores the ruby version"
195+ end
186196 end
187197
188198 context "with a .tool-versions file format" do
You can’t perform that action at this time.
0 commit comments