Rails Engine integration - #5
Merged
Merged
Conversation
hahuang65
commented
Jun 10, 2026
Member
- CHORE: Move docs/claude to docs/features
- Migrate workflows to Blacksmith
- FEATURE: Mountable Rails engine with full sign-in flow
- REFACTOR: Split test suite into separate unit and engine tasks
- CHORE: Suppress CGI deprecation warning from mocha
Add a mountable Rails engine (Bitsmithy::Auth::Engine) that owns the entire sign-in flow — send code, verify code, and sign out — with five engine routes, a self-contained SessionsController, I18n error messages, and an opt-in require_authentication! guard. What is this change? Introduces the engine at lib/bitsmithy/auth/engine.rb with isolate_namespace, routes defined in config/routes.rb (so the reloader re-draws them on reload!), and a SessionsController that includes both the shared Controller concern and the Concerns::Localization error-resolution module. Ships an en locale file covering invalid_phone_number, rate_limited, and invalid_code. Adds configuration options for after_sign_in_path, after_sign_out_path, sign_in_path, and an on_verified callback. Why is the change being made? The prior v0.1.0 release required host apps to write their own sign-in controller — roughly thirty lines of boilerplate. A mountable engine eliminates that boilerplate while remaining self-contained (no dependency on the host's ApplicationController). Host apps need only provide two view templates (phone form, code form) and one line in routes.
Run the framework-agnostic unit tests and the Rails engine integration tests as separate Ruby processes so they no longer conflict when invoked together. What is this change? Replaces the single Minitest::TestTask (which globbed all test/**/test_*.rb into one process) with two named tasks: - `rake unit` — test/bitsmithy/**/test_*.rb (no Rails boot) - `rake engine` — test/engine/**/test_*.rb (full Rails app) `rake test` runs both in sequence, each in its own process. Adds announce banners so output is clearly separated. Why is the change being made? The unit tests define a lightweight Rails env stub (RailsEnvStub) with a simple attr_accessor for Rails.env. The engine tests load Railties, which overrides Rails.env= to create an EnvironmentInquirer requiring a String argument. Running both suites in the same Ruby process causes TypeError: no implicit conversion of RailsEnvStub into String. Running them as separate processes avoids all shared-state conflicts.
Add cgi gem to the test group so mocha's equivalent_uri.rb can resolve CGI.escape without triggering a Ruby 4.0 removal warning.
hahuang65
force-pushed
the
hh/rails-engine
branch
from
June 10, 2026 19:14
8fe26c9 to
0334377
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.