如何使 I18n#t 方法在 rspec 测试中可用?

Ale*_*pov 2 rspec ruby-on-rails internationalization rails-i18n

在我的测试中我使用了I18n#t很多。有没有办法让这个方法可用而不用前缀I18n(因为它在视图中是可能的)?

mui*_*ine 5

简单地

   include ActionView::Helpers::TranslationHelper
Run Code Online (Sandbox Code Playgroud)

在适当情况下。