【问题标题】:What is the difference between the factory_bot and the factory_bot_rails gems?factory_bot 和 factory_bot_rails gem 有什么区别?
【发布时间】:2019-09-05 19:42:36
【问题描述】:

我为使用 factory_bot gem 而不是 factory_bot_rails 的 Rails 应用程序继承了代码库。

这两种宝石有什么区别? 我应该将 Gemfile 中的 gem 从 factory_bot 更改为 factory_bot_rails 吗?

以前有一个标题相似的条目,但它没有回答上面提出的任何问题 Difference between factory_girl and factory_girl_rails Ruby Gems

我也找到了这个,但它也没有给我答案 https://github.com/thoughtbot/factory_bot/issues/1118

【问题讨论】:

  • factory_bot_rails 将 Rails 集成添加到 factory_bot
  • 该项目在 2017 年之前被命名为 factory_girl,因此其他问题非常相关,几乎是一个 dup 目标。

标签: ruby-on-rails ruby rubygems factory-bot


【解决方案1】:

factory_bot_rails 只是为您的应用程序提供特定于 Rails 的 factory_bot 集成。所以是的,您应该将 Gemfile 中的 gem 更改为 factory_bot_rails。 factory_bot_rails 也会自动包含factory_bot。

【讨论】:

    猜你喜欢
    • 2011-07-21
    • 2023-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 1970-01-01
    • 2011-05-16
    相关资源
    最近更新 更多