# 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('exam...@domain.com').for(:email) }

# when run testing, pops up the error


  1) User should validate that :email is case-sensitively unique
     Failure/Error: it { should validate_uniqueness_of(:email) }

       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'

group :test do
  gem "rspec-rails"
  gem "shoulda-matchers", require: false

# 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

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

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to