1

I am using rspec-rails-3 and my version of rails is 4.0.2. I have mongodb database. While i am trying to run rspec tests, i am getting error

Failure/Error: ext_wiki = Entity.find_by(name_ref:'dev_extraction for wikipedia')
     Optionable::Unknown:
       :consistency is an unknown option. Valid options are: :write, :read, :database, :max_retries, :pool_size, :retry_interval, :refresh_interval, :down_interval, :ssl, :timeout, :instrumenter, :auto_discover.

I have a Entity named model. Code in entity_spec.rb is as follows -:

require 'rails_helper'

RSpec.describe Entity, :type => :model do
    it "checks old and new code" do
    ext_wiki = Entity.find_by(name_ref:'dev_extraction for wikipedia')
    ext_wiki1 = Entity.find_by(name_ref:'dev_extraction for wikipedia')
    expect(ext_wiki1['code']).to eq(ext_wiki['code'])
    end

    it "gives pass" do
    expect(1).to eq(1)
    end
end

2 Answers 2

4

Your Mongoid configuration (mongoid.yml) has an option (consistency) which is not a valid option. The 4.0.0 changelog says:

The :consistency option is no longer valid, use the :read option now.

Sign up to request clarification or add additional context in comments.

Comments

1

Even I change consistency to :read, it didn't work. What I did is I remove the line "consistency: :strong" line from mongoid.yml

1 Comment

is your app safer by removing consistency?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.