mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
Rename spec suite to test and remove RSpec-era traces
Move Minitest files from spec/ to test/ and update bake tasks to discover and run tests from test/**/*_test.rb. Update README and AGENTS guidance to reference test/ and tests, and drop the obsolete spec/examples.txt ignore entry.
This commit is contained in:
parent
ca316bf470
commit
6eec569358
24 changed files with 10 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,2 @@
|
||||||
www
|
www
|
||||||
Tests/*/actual
|
Tests/*/actual
|
||||||
spec/examples.txt
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@ This repository is a single Ruby static-site generator project (the legacy Swift
|
||||||
|
|
||||||
- Generator code: `lib/pressa/` (entrypoint: `lib/pressa.rb`)
|
- Generator code: `lib/pressa/` (entrypoint: `lib/pressa.rb`)
|
||||||
- Build/deploy/draft tasks: `bake.rb`
|
- Build/deploy/draft tasks: `bake.rb`
|
||||||
- Tests: `spec/`
|
- Tests: `test/`
|
||||||
- Site config: `site.toml`, `projects.toml`
|
- Site config: `site.toml`, `projects.toml`
|
||||||
- Published posts: `posts/YYYY/MM/*.md`
|
- Published posts: `posts/YYYY/MM/*.md`
|
||||||
- Static and renderable public content: `public/`
|
- Static and renderable public content: `public/`
|
||||||
- Draft posts: `public/drafts/`
|
- Draft posts: `public/drafts/`
|
||||||
- Generated output: `www/` (safe to delete/regenerate)
|
- Generated output: `www/` (safe to delete/regenerate)
|
||||||
|
|
||||||
Keep new code under the existing `Pressa` module structure (for example `lib/pressa/posts`, `lib/pressa/projects`, `lib/pressa/views`, `lib/pressa/config`, `lib/pressa/utils`) and add matching specs under `spec/`.
|
Keep new code under the existing `Pressa` module structure (for example `lib/pressa/posts`, `lib/pressa/projects`, `lib/pressa/views`, `lib/pressa/config`, `lib/pressa/utils`) and add matching tests under `test/`.
|
||||||
|
|
||||||
## Setup, Build, Test, and Development Commands
|
## Setup, Build, Test, and Development Commands
|
||||||
- Use `rbenv exec` for Ruby commands in this repository (for example `rbenv exec bundle exec ...`) to ensure the project Ruby version is used.
|
- Use `rbenv exec` for Ruby commands in this repository (for example `rbenv exec bundle exec ...`) to ensure the project Ruby version is used.
|
||||||
|
|
@ -52,8 +52,8 @@ Optional keys include `Tags`, `Link`, `Scripts`, and `Styles`.
|
||||||
- Do not hand-edit generated files in `www/`.
|
- Do not hand-edit generated files in `www/`.
|
||||||
|
|
||||||
## Testing Guidelines
|
## Testing Guidelines
|
||||||
- Use Minitest under `spec/` (for example `spec/posts`, `spec/config`, `spec/views`).
|
- Use Minitest under `test/` (for example `test/posts`, `test/config`, `test/views`).
|
||||||
- Add regression specs for parser, rendering, feed, and generator behavior changes.
|
- Add regression tests for parser, rendering, feed, and generator behavior changes.
|
||||||
- Before submitting, run:
|
- Before submitting, run:
|
||||||
- `rbenv exec bundle exec bake test`
|
- `rbenv exec bundle exec bake test`
|
||||||
- `rbenv exec bundle exec bake coverage`
|
- `rbenv exec bundle exec bake coverage`
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ If what you want is an artisanal, hand-crafted, static site generator for your p
|
||||||
|
|
||||||
- Generator core: `lib/pressa/` (entrypoint: `lib/pressa.rb`)
|
- Generator core: `lib/pressa/` (entrypoint: `lib/pressa.rb`)
|
||||||
- Build tasks and utility workflows: `bake.rb`
|
- Build tasks and utility workflows: `bake.rb`
|
||||||
- Tests: `spec/`
|
- Tests: `test/`
|
||||||
- Config: `site.toml` and `projects.toml`
|
- Config: `site.toml` and `projects.toml`
|
||||||
- Content: `posts/` and `public/`
|
- Content: `posts/` and `public/`
|
||||||
- Output: `www/`
|
- Output: `www/`
|
||||||
|
|
|
||||||
10
bake.rb
10
bake.rb
|
|
@ -13,7 +13,7 @@ PUBLISH_HOST = "mudge".freeze
|
||||||
PRODUCTION_PUBLISH_DIR = "/var/www/samhuri.net/public".freeze
|
PRODUCTION_PUBLISH_DIR = "/var/www/samhuri.net/public".freeze
|
||||||
BETA_PUBLISH_DIR = "/var/www/beta.samhuri.net/public".freeze
|
BETA_PUBLISH_DIR = "/var/www/beta.samhuri.net/public".freeze
|
||||||
WATCHABLE_DIRECTORIES = %w[public posts lib].freeze
|
WATCHABLE_DIRECTORIES = %w[public posts lib].freeze
|
||||||
LINT_TARGETS = %w[bake.rb Gemfile lib spec].freeze
|
LINT_TARGETS = %w[bake.rb Gemfile lib test].freeze
|
||||||
BUILD_TARGETS = %w[debug mudge beta release].freeze
|
BUILD_TARGETS = %w[debug mudge beta release].freeze
|
||||||
|
|
||||||
# Generate the site in debug mode (localhost:8000)
|
# Generate the site in debug mode (localhost:8000)
|
||||||
|
|
@ -217,7 +217,7 @@ end
|
||||||
private
|
private
|
||||||
|
|
||||||
def run_test_suite(test_files)
|
def run_test_suite(test_files)
|
||||||
run_command("ruby", "-Ilib", "-Ispec", "-e", "ARGV.each { |file| require File.expand_path(file) }", *test_files)
|
run_command("ruby", "-Ilib", "-Itest", "-e", "ARGV.each { |file| require File.expand_path(file) }", *test_files)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_coverage(test_files:, lowest_count:)
|
def run_coverage(test_files:, lowest_count:)
|
||||||
|
|
@ -226,8 +226,8 @@ def run_coverage(test_files:, lowest_count:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_file_list(chdir: Dir.pwd)
|
def test_file_list(chdir: Dir.pwd)
|
||||||
test_files = Dir.chdir(chdir) { Dir.glob("spec/**/*_test.rb").sort }
|
test_files = Dir.chdir(chdir) { Dir.glob("test/**/*_test.rb").sort }
|
||||||
abort "Error: no tests found in spec/**/*_test.rb under #{chdir}" if test_files.empty?
|
abort "Error: no tests found in test/**/*_test.rb under #{chdir}" if test_files.empty?
|
||||||
|
|
||||||
test_files
|
test_files
|
||||||
end
|
end
|
||||||
|
|
@ -277,7 +277,7 @@ def coverage_script(lowest_count:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def capture_coverage_output(test_files:, lowest_count:, chdir:)
|
def capture_coverage_output(test_files:, lowest_count:, chdir:)
|
||||||
capture_command("ruby", "-Ilib", "-Ispec", "-e", coverage_script(lowest_count:), *test_files, chdir:)
|
capture_command("ruby", "-Ilib", "-Itest", "-e", coverage_script(lowest_count:), *test_files, chdir:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_coverage_percent(output)
|
def parse_coverage_percent(output)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue