Skip to content

🧪 Add authorization, helper, and response format tests#75

Merged
fusion94 merged 1 commit intomasterfrom
feat/63-65-test-suite
Mar 18, 2026
Merged

🧪 Add authorization, helper, and response format tests#75
fusion94 merged 1 commit intomasterfrom
feat/63-65-test-suite

Conversation

@fusion94
Copy link
Copy Markdown
Collaborator

Summary

21 new tests covering authorization (#63), helper methods (#64), and JSON/Atom response formats (#65).

Changes

  • spec/integration/authorization_spec.rb: 7 tests for unauthorized access + non-existent records
  • spec/unit/changes_helper_spec.rb: 7 tests for text_or_nil, changes_for, change_item_types, version_reify
  • spec/integration/response_formats_spec.rb: 7 tests for JSON/Atom responses + filters
  • spec/app_template.rb: Added root route for redirect tests

Test Results

  • 40 examples, 0 failures (Rails 7.1 + kaminari)
  • 40 examples, 0 failures (Rails 7.1 + will_paginate)

Closes #63
Closes #64
Closes #65

#63 — Authorization integration tests (7 new):
- Unauthorized index/show/revert redirect with error flash
- Non-existent change show/revert redirect with error
- Non-existent type filter returns empty list
- Root route added to dummy app for redirect tests

#64 — ChangesHelper unit tests (7 new):
- text_or_nil: nil styling, text escaping, HTML escaping
- changes_for: create, update, destroy events
- change_item_types: returns sorted versioned models
- version_reify: returns reified record

#65 — Response format tests (7 new):
- JSON index returns array of versions
- JSON show returns single version
- JSON respects type and id filters
- Atom feed returns valid XML with entries
- Atom respects type filter

Test count: 19 → 40 (+21 new tests)

Closes #63
Closes #64
Closes #65
@fusion94 fusion94 merged commit 511a5fb into master Mar 18, 2026
18 checks passed
@fusion94 fusion94 deleted the feat/63-65-test-suite branch March 18, 2026 18:24
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.

Add specs for JSON and Atom response formats Add unit tests for ChangesHelper methods Implement authorization test cases (6 commented-out TODOs)

1 participant