Skip to content

Commit 23717d1

Browse files
committed
Tighten skipped-count test to a 2-spec Tempfile run
Uses --add-specs with one normal failing spec and one features:[ruby_types] spec, filtered by -n so only those two run. source_echo_adapter opts out of ruby_types, so exactly 1 spec is skipped — asserts ', 1 skipped.' precisely without running a full suite.
1 parent de814ac commit 23717d1

1 file changed

Lines changed: 28 additions & 9 deletions

File tree

test/runner_diagnostics_test.rb

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,35 @@ def test_plain_output_starts_with_complexity_bar_summary_and_omits_suite_preambl
107107
end
108108

109109
def test_plain_summary_includes_skipped_count_when_specs_are_filtered
110-
stdout, _stderr, status = run_liquid_spec(
111-
"empty_adapter.rb",
112-
"-s", "basics",
113-
"--max-failures", "1"
114-
)
110+
Tempfile.create(["liquid-spec-skipped", ".yml"]) do |file|
111+
file.write(<<~YML)
112+
---
113+
- name: normal_failure
114+
template: "{{ nope }}"
115+
expected: "not source echo"
116+
complexity: 10
117+
hint: "Normal failing spec."
118+
- name: ruby_types_skipped
119+
template: "{{ x }}"
120+
expected: "y"
121+
complexity: 10
122+
features: [ruby_types]
123+
hint: "Skipped because adapter opts out of ruby_types."
124+
YML
125+
file.close
115126

116-
assert_equal 1, status
117-
# empty_adapter opts out of ruby_types/ruby_drops/etc.; basics has specs
118-
# requiring those, so the summary must report a positive skipped count.
119-
assert_match(/, [1-9]\d* skipped\./, stdout)
127+
stdout, _stderr, status = run_liquid_spec(
128+
"source_echo_adapter.rb",
129+
"--add-specs", file.path,
130+
"-n", "/^(normal_failure|ruby_types_skipped)$/",
131+
"--max-failures", "1"
132+
)
133+
134+
assert_equal 1, status
135+
assert_includes stdout, "1) [c=10] normal_failure"
136+
refute_includes stdout, "ruby_types_skipped"
137+
assert_match(/, 1 skipped\./, stdout)
138+
end
120139
end
121140

122141
def test_printed_failures_are_lowest_complexity_across_prioritized_and_suite_specs

0 commit comments

Comments
 (0)