# 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) }
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 :)

-- 
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 
https://groups.google.com/d/msgid/rubyonrails-talk/ab193d05-f8c1-4936-88f3-4b553bb2ef78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to