Error Suit test mongoid

good afternoon

i started a project that has mongo as a requirement, installed Mongoid and let the generator create the file config / mongoid.yml. But I’m struggling to set up the test.

describe User do

before { @user = FactoryGirl.build(:user) }

subject { @user }

it { should respond_to(:email) }

it { should respond_to(:password) }

it { should respond_to(:password_confirmation) }

it { should be_valid }

it { should validate_presence_of(:email) }

it { should validate_uniqueness_of(:email) }

it { should validate_confirmation_of(:password) }

it { should allow_value(‘example@domain.com’).for(:email) }

end

when run testing, pops up the error

Failures:

  1. User should validate that :email is case-sensitively unique

Failure/Error: it { should validate_uniqueness_of(:email) }

NameError:

uninitialized constant ActiveRecord

i think the mongoid is not being used in the test

the gems that i’m using are these

gem ‘mongoid’, git: ‘https://github.com/mongodb/mongoid

group :development, :test do

gem “factory_girl_rails”

gem ‘ffaker’

end

group :test do

gem “rspec-rails”

gem “shoulda-matchers”, require: false

end

and the support/shoulda_matchers.rb

require “shoulda/matchers”

Shoulda::Matchers.configure do |config|

config.integrate do |with|

with.test_framework :rspec

with.library :rails

end

end

you could help me set up the test correctly with mongo??

thank you :slight_smile: