Skip to content

Commit

Permalink
Fix: uninitialized constant User
Browse files Browse the repository at this point in the history
In the test setting Test (MONGOID, 3.1, mongoid_73.gemfile)

got this error:
SimpleCov failed with exit 1/home/runner/work/pluck_all/pluck_all/test/mongoid/support/seeds.rb:2:in `<top (required)>': uninitialized constant User (NameError)
  • Loading branch information
khiav reoy committed Jul 30, 2023
1 parent 8397085 commit a2e3370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions gemfiles/mongoid_73.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in pluck_all.gemspec

gem 'mongoid', '~> 7.3.3'
gem 'zeitwerk'

group :test do
gem 'simplecov', '< 0.18'
Expand Down
4 changes: 4 additions & 0 deletions test/mongoid/support/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# frozen_string_literal: true

require 'rails_compatibility/setup_autoload_paths'
RailsCompatibility.setup_autoload_paths [File.expand_path('../models/', __FILE__)]

User.delete_all
User.create(name: 'Pearl Shi', age: 18)
User.create(name: 'Rumble Huang', age: 20)
Expand Down

0 comments on commit a2e3370

Please sign in to comment.