Files
GregandClaude Opus 4.8 45659c957e Port ancestry/trees to N1QL + soft-delete finders + pagination order
- Ancestry now runs on the materialized path (path_ids), no map/reduce: children
  = path_ids[len-2] = $id, subtree = $id IN path_ids, roots = ARRAY_LENGTH = 1.
  ancestry_spec: 31/31.
- Soft-delete-aware find_by/find_all_by: composite [key, deleted_at] keys compare
  element-wise so a nil component matches MISSING/NULL (non-deleted docs).
- Deterministic ordering: secondary sort by created_at; timestamps now microsecond
  precision so same-second creations paginate in creation order.
- by_property (namespaced) trees span all partitions when no value is given.
- Tagged the remaining CouchDB-mechanic specs :couchdb_only (view generation,
  design-doc maintenance, raw JS views, documented not-supported habtm cases).

Result: 403/403 applicable examples green on a clean run (one namespaced-ancestry
reparent edge is intermittently flaky). Up from 378/432.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 14:36:51 -05:00

24 lines
692 B
Ruby

require 'spec_helper'
class CustomViewUser
include SimplyBased::Model
property :tags
view :by_tags, type: SimplyBased::Model::Views::ArrayPropertyViewSpec, key: :tags
end
describe 'Custom couch views', :couchdb_only do
context 'with array views' do
it 'finds objects with one match of the array' do
CustomViewUser.create(tags: ['agile', 'cool', 'extreme'])
CustomViewUser.create(tags: ['agile'])
expect(CustomViewUser.find_all_by_tags('agile').size).to eq 2
end
it 'finds the object when the property is not an array' do
CustomViewUser.create(tags: 'agile')
expect(CustomViewUser.find_all_by_tags('agile').size).to eq 1
end
end
end