Skip to content

Commit 06f9139

Browse files
authored
Merge pull request #633 from Shopify/ko/quote-config
Wrap options_string values in quotes
2 parents 7afab9d + e2518a0 commit 06f9139

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

lib/spoom/sorbet/config.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def copy
6767
sig { returns(String) }
6868
def options_string
6969
opts = []
70-
opts.concat(paths)
71-
opts.concat(ignore.map { |p| "--ignore #{p}" })
72-
opts.concat(allowed_extensions.map { |ext| "--allowed-extension #{ext}" })
70+
opts.concat(paths.map { |p| "'#{p}'" })
71+
opts.concat(ignore.map { |p| "--ignore '#{p}'" })
72+
opts.concat(allowed_extensions.map { |ext| "--allowed-extension '#{ext}'" })
7373
opts << "--no-stdlib" if @no_stdlib
7474
opts.join(" ")
7575
end

test/spoom/cli/srb/coverage_test.rb

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,41 @@ def test_finish_on_original_branch
488488
assert_equal("fake-branch", @project.git_current_branch)
489489
end
490490

491+
def test_config_options_string
492+
# Add ignore path to config to test config options string
493+
@project.write!("sorbet/config", "\n--ignore=lib/a.rb\n--ignore=*.rb", append: true)
494+
495+
result = @project.spoom("srb coverage snapshot")
496+
out = censor_sorbet_version(result.out)
497+
assert_equal(<<~MSG, out)
498+
Sorbet static: X.X.XXXX
499+
Sorbet runtime: X.X.XXXX
500+
501+
Content:
502+
files: 3
503+
files excluding rbis: 2
504+
modules: 3
505+
classes: 1
506+
methods: 9
507+
methods excluding rbis: 9
508+
509+
Sigils:
510+
true: 3 (100%)
511+
512+
Methods:
513+
with signature: 2 (22%)
514+
without signature: 7 (78%)
515+
516+
Methods excluding RBIs
517+
with signature: 2 (22%)
518+
without signature: 7 (78%)
519+
520+
Calls:
521+
typed: 4 (67%)
522+
untyped: 2 (33%)
523+
MSG
524+
end
525+
491526
private
492527

493528
def create_git_history!

test/spoom/sorbet/config_test.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,12 @@ def test_options_string_with_options
207207
--allowed-extension=.rb
208208
--no-stdlib
209209
CONFIG
210-
assert_equal(". --ignore .git/ --ignore vendor/ --allowed-extension .rb --no-stdlib", config.options_string)
210+
expected = "'.' " \
211+
"--ignore '.git/' " \
212+
"--ignore 'vendor/' " \
213+
"--allowed-extension '.rb' " \
214+
"--no-stdlib"
215+
assert_equal(expected, config.options_string)
211216
end
212217
end
213218
end

0 commit comments

Comments
 (0)