From 80d84ff6435fe79482587bdab205ecbac09db5f6 Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Thu, 23 Nov 2023 12:46:36 +0100 Subject: [PATCH] Provide non regression feature test when ActiveRecord::Base is loaded It happens if the AR::Base as already been loaded. For example: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/91 --- features/initializers.feature | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 features/initializers.feature diff --git a/features/initializers.feature b/features/initializers.feature new file mode 100644 index 0000000..823966c --- /dev/null +++ b/features/initializers.feature @@ -0,0 +1,15 @@ +Feature: properly integrate with Rails and other gems + + Background: + When I create a new rails application + And I add "factory_bot_rails" from this project as a dependency + And I run `bundle install` with a clean environment + + Scenario: handle already loaded ActiveRecord::Base by another gems earlier + When I run the following commands: + """bash + cat config/application.rb + sed -i -e '/require "rails\/test_unit\/railtie"/a\'$'\n''require "active_record/base"' config/application.rb + """ + When I run `bundle exec rake test` with a clean environment + Then the output should contain "0 runs"