Skip to content

Commit f1fa32a

Browse files
committed
test: catch each form of a maintainer count
The count pattern now finds numerals and plural forms, and a test checks the pattern against examples. The maintenance page test now checks the name and profile link of the lead maintainer. The changelog no longer says that the versioning page links to the maintenance page.
1 parent 4a0fc71 commit f1fa32a

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
- Add `docs/maintenance.md`. It tells you who maintains the gem, how CI checks
66
each change, how a release is published, what you keep if maintenance
7-
stops, and how to become a maintainer. The README, `docs/versioning.md`, and
8-
the comparison pages now link to this page and no longer state a count of
9-
maintainers. A new test fails when a page states one.
7+
stops, and how to become a maintainer. The README and the comparison pages
8+
now link to this page. They and `docs/versioning.md` no longer state a count
9+
of maintainers. A new test fails when a page states one.
1010

1111
## 1.0.2 - 2026-10-15
1212

‎test/unit/maintenance_documents_test.rb‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,35 @@
44

55
class MaintenanceDocumentsTest < ActiveSupport::TestCase
66
ROOT = File.expand_path("../..", __dir__)
7-
MAINTAINER_COUNT = /\b(?:one|only|sole|single)\s+maintainer\b/i
7+
MAINTAINER_COUNT = /\b(?:\d+|one|two|three|four|five|six|seven|eight|nine|ten|only|sole|single)\s+maintainers?\b/i
88

99
def guide(path)
1010
File.read(File.join(ROOT, path))
1111
end
1212

13-
def documentation_paths
14-
[ "README.md", "CONTRIBUTING.md", *Dir.glob("docs/**/*.md", base: ROOT).sort ]
15-
end
16-
1713
test "the README links to the maintenance page" do
1814
assert_includes guide("README.md"), "(docs/maintenance.md)"
1915
end
2016

2117
test "the maintenance page names the lead maintainer" do
22-
assert_match(/is the lead\s+maintainer/, guide("docs/maintenance.md"))
18+
assert_match(
19+
%r{Lucas Carlson \(\[@cardmagic\]\(https://github\.com/cardmagic\)\) is the lead\s+maintainer},
20+
guide("docs/maintenance.md")
21+
)
22+
end
23+
24+
test "the count pattern finds a count of maintainers in each form" do
25+
[ "One maintainer.", "1 maintainer", "two maintainers", "the only\nmaintainer" ].each do |text|
26+
assert_match MAINTAINER_COUNT, text
27+
end
28+
[ "the lead maintainer", "wants more maintainers", "become a maintainer" ].each do |text|
29+
refute_match MAINTAINER_COUNT, text
30+
end
2331
end
2432

2533
test "no page states a count of maintainers" do
26-
pages = documentation_paths.select { |path| guide(path).match?(MAINTAINER_COUNT) }
34+
paths = [ "README.md", "CONTRIBUTING.md", *Dir.glob("docs/**/*.md", base: ROOT).sort ]
35+
pages = paths.select { |path| guide(path).match?(MAINTAINER_COUNT) }
2736

2837
assert_empty pages
2938
end

0 commit comments

Comments
 (0)