File, layer, and slice dependency rules
Architecture testing for Ruby
ArchUnitRuby
Build a dependency graph from a Ruby codebase and guard cycles, layers, naming, metrics, slices, and diagrams as ordinary tests. The working prototype ships as the archunit gem and includes source-generated API documentation.
RubyGems
gem install archunitrequire 'archunit'
RSpec.describe 'architecture' do
it 'keeps API away from persistence' do
rule = ArchUnit.project_files
.in_folder('app/api/**')
.should_not.depend_on_files
.in_folder('app/database/**')
expect(rule).to pass
end
endCapabilities
What ArchUnitRuby brings to the test suite.
The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.
RSpec and Minitest integrations
Naming, location, and external-module policies
Metrics and dependency graph reports
PlantUML adherence and exports
Structured violations and custom predicates
Current maturity
Working preview
A working executable prototype published as version 0.0.1 and tested on current Ruby releases.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnitRuby include the following project shapes.
More ecosystems
The same intent, expressed natively.
Explore sibling implementations and carry the architecture vocabulary across a polyglot system.
Make the first boundary executable.
Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.
Start with ArchUnitRuby ↗