rakshans1 · GitHub

Introduces centralized helper modules for cleaner, more maintainable tests:
- StubHelper: Centralized stub configuration (with_email_success, with_storage_failure, etc.)
- AssertHelper: Domain-specific assertions (assert_todo_valid, assert_changeset_error, etc.)
- SetupHelper: Reusable setup functions (with_todo, with_mixed_todos, etc.)
All helpers are auto-imported via DataCase for seamless usage.
Patterns Demonstrated:
- Composable setup with named functions: setup [:with_email_success, :with_todos]
- Assertion chaining: todo |> assert_todo_valid() |> assert_todo_incomplete()
- Context-aware setup functions for ExUnit's setup macro
Blog Post: Part 6 - Centralized Test Helpers

@rakshans1

rakshans1 added a commit that referenced this pull request

Dec 25, 2025
Introduces Phoenix controller testing with ConnCase:
- User schema and context for auth simulation
- TodoController with full CRUD operations
- TodoJSON for JSON rendering
- FallbackController for error handling
- ConnSimulator for authentication helpers
- Comprehensive controller tests
Patterns Demonstrated:
- ConnCase template usage
- JSON response assertions
- Testing CRUD operations
- Error case testing (404, 422)
- Authentication simulation
Blog Post: Part 7 - Testing Phoenix Controllers

rakshans1 added a commit that referenced this pull request

Dec 25, 2025
Introduces Phoenix controller testing with ConnCase:
- User schema and context for auth simulation
- TodoController with full CRUD operations
- TodoJSON for JSON rendering
- FallbackController for error handling
- ConnSimulator for authentication helpers
- Comprehensive controller tests
Patterns Demonstrated:
- ConnCase template usage
- JSON response assertions
- Testing CRUD operations
- Error case testing (404, 422)
- Authentication simulation
Blog Post: Part 7 - Testing Phoenix Controllers

Read the original on github.com ↗