mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +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
|
||||
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`)
|
||||
- Build/deploy/draft tasks: `bake.rb`
|
||||
- Tests: `spec/`
|
||||
- Tests: `test/`
|
||||
- Site config: `site.toml`, `projects.toml`
|
||||
- Published posts: `posts/YYYY/MM/*.md`
|
||||
- Static and renderable public content: `public/`
|
||||
- Draft posts: `public/drafts/`
|
||||
- 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
|
||||
- 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/`.
|
||||
|
||||
## Testing Guidelines
|
||||
- Use Minitest under `spec/` (for example `spec/posts`, `spec/config`, `spec/views`).
|
||||
- Add regression specs for parser, rendering, feed, and generator behavior changes.
|
||||
- Use Minitest under `test/` (for example `test/posts`, `test/config`, `test/views`).
|
||||
- Add regression tests for parser, rendering, feed, and generator behavior changes.
|
||||
- Before submitting, run:
|
||||
- `rbenv exec bundle exec bake test`
|
||||
- `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`)
|
||||
- Build tasks and utility workflows: `bake.rb`
|
||||
- Tests: `spec/`
|
||||
- Tests: `test/`
|
||||
- Config: `site.toml` and `projects.toml`
|
||||
- Content: `posts/` and `public/`
|
||||
- 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
|
||||
BETA_PUBLISH_DIR = "/var/www/beta.samhuri.net/public".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
|
||||
|
||||
# Generate the site in debug mode (localhost:8000)
|
||||
|
|
@ -217,7 +217,7 @@ end
|
|||
private
|
||||
|
||||
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
|
||||
|
||||
def run_coverage(test_files:, lowest_count:)
|
||||
|
|
@ -226,8 +226,8 @@ def run_coverage(test_files:, lowest_count:)
|
|||
end
|
||||
|
||||
def test_file_list(chdir: Dir.pwd)
|
||||
test_files = Dir.chdir(chdir) { Dir.glob("spec/**/*_test.rb").sort }
|
||||
abort "Error: no tests found in spec/**/*_test.rb under #{chdir}" if test_files.empty?
|
||||
test_files = Dir.chdir(chdir) { Dir.glob("test/**/*_test.rb").sort }
|
||||
abort "Error: no tests found in test/**/*_test.rb under #{chdir}" if test_files.empty?
|
||||
|
||||
test_files
|
||||
end
|
||||
|
|
@ -277,7 +277,7 @@ def coverage_script(lowest_count:)
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def parse_coverage_percent(output)
|
||||
|
|
|
|||
Loading…
Reference in a new issue