Skip to content

Commit aa9fc58

Browse files
committed
Add coverage test that utilizes options parsing
1 parent dac0d85 commit aa9fc58

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

test/spoom/cli/srb/coverage_test.rb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,77 @@ 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", 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+
526+
def test_config_options_string_ignores_wildcard
527+
# Add ignore path to config to test config options string
528+
@project.write!("sorbet/config", "\n--ignore=*/a.rb", append: true)
529+
530+
result = @project.spoom("srb coverage snapshot")
531+
out = censor_sorbet_version(result.out)
532+
assert_equal(<<~MSG, out)
533+
Sorbet static: X.X.XXXX
534+
Sorbet runtime: X.X.XXXX
535+
536+
Content:
537+
files: 4
538+
files excluding rbis: 3
539+
modules: 5
540+
classes: 2
541+
methods: 14
542+
methods excluding rbis: 14
543+
544+
Sigils:
545+
false: 1 (25%)
546+
true: 3 (75%)
547+
548+
Methods:
549+
with signature: 2 (14%)
550+
without signature: 12 (86%)
551+
552+
Methods excluding RBIs
553+
with signature: 2 (14%)
554+
without signature: 12 (86%)
555+
556+
Calls:
557+
typed: 5 (83%)
558+
untyped: 1 (17%)
559+
MSG
560+
end
561+
491562
private
492563

493564
def create_git_history!

0 commit comments

Comments
 (0)