Skip to content

Generate the test fixtures from a rake task - #63

Merged
njakobsen merged 1 commit into
masterfrom
synthetic-fixtures
Aug 16, 2026
Merged

Generate the test fixtures from a rake task#63
njakobsen merged 1 commit into
masterfrom
synthetic-fixtures

Conversation

@njakobsen

Copy link
Copy Markdown
Member

bundle exec rake fixtures:build now builds every file in spec/fixtures.

The shapefiles are squares on a regular grid in NAD83 / UTM zone 11N, written with ogr2ogr. The KML and GeoJSON documents are the same squares in round degrees. The JPEGs embedded in kmz_with_images.kmz come from a constant in the task, so the only external tool involved is ogr2ogr, which is already needed to run the suite.

Each fixture keeps the structure its specs exercise — the missing component, the .shx whose basename does not match the .shp, the __MACOSX decoy carrying a real extension, the single-vertex LineString, the null geometry, the name longer than the name column. Every feature count is unchanged, so the assertions that were about behaviour still are. Layer, placemark and attribute names are generic, and three specs that named a component file or an overlay were updated to match.

tasks/ sits outside the gemspec's s.files, so the task stays in the repository. The Dir[] that loads it from the Rakefile returns an empty array when the gem is unpacked on its own, so nothing changes for consumers.

The fixture directory drops from 3.2 MB to 116 KB. Full suite is green locally: 266 examples, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_017uHh49RG66T3qNFNRnPY6s

`rake fixtures:build` now builds every file in `spec/fixtures`. The shapefiles are squares on a regular grid in NAD83 / UTM zone 11N, written with `ogr2ogr`; the KML and GeoJSON documents are the same squares in round degrees; and the JPEGs embedded in `kmz_with_images.kmz` come from a constant, so the task needs no image tooling.

Each fixture keeps the structure its specs exercise — the missing component, the `.shx` whose basename does not match the `.shp`, the `__MACOSX` decoy carrying a real extension, the single-vertex LineString, the null geometry, the name longer than the name column — and every feature count is unchanged, so the assertions that were about behaviour still are. Layer, placemark and attribute names are generic, and the three specs that named a component file or an overlay were updated to match.

`tasks/` is outside the gemspec's `s.files`, so the task stays in the repository, and the `Dir[]` that loads it from the `Rakefile` finds nothing when the gem is unpacked on its own. The fixture directory drops from 3.2 MB to 116 KB.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@njakobsen
njakobsen merged commit 83c522d into master Aug 16, 2026
2 checks passed
@njakobsen
njakobsen deleted the synthetic-fixtures branch August 17, 2026 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant