mirror of
https://github.com/we-promise/sure.git
synced 2026-09-08 16:14:23 +00:00
* Document instruction inventory and preservation decisions Trace main history from September 2025 through September 2026, including earlier policy origins. Record preserved requirements, detailed-guide destinations, stale facts, harness boundaries and explicit policy-strength decisions before consolidating instruction sources. * Consolidate repository instructions into shared guidance Keep AGENTS concise and vendor neutral, move detailed conventions into shared guides, and use thin adapters with preserved Cursor scopes. Preserve the strict pre-PR checks globally and document the stronger scope, retired migration pin and rule-generation trigger. Update existing API guidance verification without changing application behavior. * Narrow the always-on Cursor UI adapter and correct the SimpleFIN comment Split the design-system guidance out of docs/llm-guides/ui.md into docs/llm-guides/design-system.md. The ui-ux-design-guidelines rule is alwaysApply: true, so importing all of ui.md loaded the Stimulus, localization and ViewComponent guidance (previously confined to scoped rules) on every Cursor session; the always-on adapter now imports only the design-system guide, matching the scope it had before the consolidation. view_conventions and stimulus_conventions keep the full UI guide. Also correct the stale Provider::Simplefin header comment: pending inclusion defaults on and is resolved by the importer (explicit argument, then SIMPLEFIN_INCLUDE_PENDING, then Setting.syncs_include_pending); the previous comment described the flag as default-off. * Read guidance files as UTF-8 in the API consistency validators The frontmatter regex match ran against content read with the locale default external encoding; the Cursor rule's description contains an em dash, so under US-ASCII (LC_ALL=C) Regexp#match raised ArgumentError, breaking the standalone no-Rails fallback the docs point contributors to. Read all checked files with an explicit UTF-8 encoding in both the standalone script and the Rails test.
2.0 KiB
2.0 KiB
Testing
Use Rails Minitest and fixtures for behavioral tests; do not introduce RSpec behavioral tests or factories. RSpec/rswag is the explicit exception for OpenAPI documentation only.
- Mirror
app/undertest/and name files*_test.rb. - Keep fixtures small: normally two or three per model representing base cases.
Create edge cases within the test that needs them. Use Rails helpers for large
data sets, such as
EntriesTestHelper. - Write tests while implementing critical behavior. Prefer unit tests plus focused integration tests; use system tests sparingly for critical user flows.
- Test code paths that significantly increase confidence. Do not add tests merely to verify ActiveRecord's built-in persistence or duplicate another class's tests.
- Respect class boundaries: verify query outputs and that commands receive the correct arguments. Do not inspect another class's internal implementation.
- Use Mocha for stubs/mocks. Prefer
OpenStructfor mock instances, or a small mock class for complex cases. Only mock what the test needs; do not stub return values that are irrelevant to the behavior under test. - Use VCR for external API calls and existing cassettes in
test/vcr_cassettes/. Keep credentials out of recordings; filters and shared setup live intest/test_helper.rb.
For example, when testing an orchestrator, set the command expectation before calling the subject, then check the subject's returned result:
test "passes the result to the processor" do
CustomEventProcessor.expects(:process_result).with(4).once
assert_equal 4, ExampleClass.new.do_something
end
This illustrates a test boundary; it does not prescribe new classes. Follow existing model/controller tests for real fixtures and API setup.
Use the commands and full pre-PR checklist. API changes also require the post-commit consistency checklist.