-
Notifications
You must be signed in to change notification settings - Fork 486
Closed
Description
To be right on point, here's my spec_helper.rb:
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require 'mongoid'
require 'rspec/rails'
require 'factory_bot_rails'
require 'rails/mongoid'
require 'database_cleaner'
require 'mongoid-rspec'
Mongoid.load!(Rails.root.join('config', 'mongoid.yml'))
Rails.backtrace_cleaner.remove_silencers!
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
RSpec.configure do |config|
config.mock_with :rspec
config.infer_base_class_for_anonymous_controllers = false
config.order = 'random'
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.orm = 'mongoid'
end
config.before(:each) do
DatabaseCleaner.clean
end
endWhen I run bundle exec rspec, it throws:
An error occurred in a `before(:suite)` hook.
Failure/Error: DatabaseCleaner.orm = 'mongoid'
NoMethodError:
undefined method `orm=' for DatabaseCleaner:Module
# ./spec/spec_helper.rb:23:in `block (2 levels) in <top (required)>'Metadata
Metadata
Assignees
Labels
No labels