Reputation: 3959
I'm incrementally adding RBS type signatures to my Ruby (not Rails) project. The project contains a Rakefile
for running tests manually, but also a Guardfile
for running tests when files change.
For that reason I've added the RBS setup to spec_helper.rb
, to avoid having to duplicate it in both Rakefile
and Guardfile
.
# spec_helper.rb
ENV['RBS_TEST_TARGET'] ||= 'MyModule::*'
require 'rbs/test/setup'
This works as expected - the type signatures are verified regardless of what winds up running the specs. It feels like a bit of a hack, though; is there a better or even a more idiomatic way of doing this?
Upvotes: 3
Views: 261