为什么铁轨不是生成规格而是淘汰的?

发布于 2025-01-25 05:52:30 字数 664 浏览 2 评论 0原文

我正在使用Rails 7。 我刚刚以这种方式安装了rspec-rails

# Gemfile
group :test do
  gem "rspec-rails"
end

我生成了一个控制器。

$ rails g controller welcome home
      create  app/controllers/welcome_controller.rb
       route  get 'welcome/home'
      invoke  erb
      create    app/views/welcome
      create    app/views/welcome/home.html.erb
      invoke  test_unit
      create    test/controllers/welcome_controller_test.rb
      invoke  helper
      create    app/helpers/welcome_helper.rb
      invoke    test_unit

但是我发现铁轨生成了最大的,而不是规格。

为什么这是?我该怎么办来解决这个问题?

I'm using rails 7.
I've just installed rspec-rails in this way:

# Gemfile
group :test do
  gem "rspec-rails"
end

And I generated a controller.

$ rails g controller welcome home
      create  app/controllers/welcome_controller.rb
       route  get 'welcome/home'
      invoke  erb
      create    app/views/welcome
      create    app/views/welcome/home.html.erb
      invoke  test_unit
      create    test/controllers/welcome_controller_test.rb
      invoke  helper
      create    app/helpers/welcome_helper.rb
      invoke    test_unit

But I found out that rails generated minitests instead of specs.

Why is this? What should I do to fix this out?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

も让我眼熟你 2025-02-01 05:52:30

有必要将RSPEC-RAILS添加到:开发组以使生成器正常工作。

# Gemfile
group :test, :development do
  gem "rspec-rails"
end

我发现了在这里

It is necessary to add rspec-rails to :development group in order to get generators working.

# Gemfile
group :test, :development do
  gem "rspec-rails"
end

I found this out here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文