如何将依赖项添加到Rails Engine的虚拟应用程序中?

发布于 2025-01-24 10:46:13 字数 630 浏览 4 评论 0原文

我想在测试/虚拟应用程序中添加一些依赖项,以便可以对引擎进行集成测试。我添加了一个测试/虚拟/gemfile,并将依赖项放在上面:

gem 'devise'
gem 'devise_invitable'

在测试/虚拟中运行捆绑包后,创建了测试/虚拟/gemfile.lock。

但是,当我运行Rails G设计:安装在测试/虚拟中时,它说

method_missing': undefined method `active_storage' for #<Rails::Application::Configuration:0x00007fad8f2a0dc0> (NoMethodError)

我如何能够在虚拟应用程序中添加依赖关系? 我可以使它工作的唯一方法是将其添加到引擎宝石的依赖项中。但是我宁愿不这样做

:我可以在gemfile中添加导轨,并且可以运行安装,但是在进行测试后,它会有此错误:

test/dummy/config/initializers/devise.rb:11:in `<top (required)>': uninitialized constant Devise (NameError)

I would like to add a few dependencies in my test/dummy app so that I can do integration test of my engine. I added a test/dummy/Gemfile and put the dependencies on it:

gem 'devise'
gem 'devise_invitable'

after I run bundle install inside the test/dummy, the test/dummy/Gemfile.lock is created.

but when I run rails g devise:install inside the test/dummy, it says

method_missing': undefined method `active_storage' for #<Rails::Application::Configuration:0x00007fad8f2a0dc0> (NoMethodError)

How am I able to add dependencies to the dummy app?
The only way I can get it to work is if I add it to the dependencies of my engine gem. but I prefer not to do that

EDIT: I added rails in my Gemfile and devise install can be run, but after I run my test, it has this error:

test/dummy/config/initializers/devise.rb:11:in `<top (required)>': uninitialized constant Devise (NameError)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文