-
Type: Bug
-
Resolution: Done
-
Priority: Critical - P2
-
Affects Version/s: 2.1.0
-
Component/s: None
-
None
-
Environment:mac osx
Let's say I have a User model.
In the app or console, I can do User.all.first or User.all.count but if I do the same thing when running rspec, I get this error:
NoMethodError:
undefined method `merge' for "primary":String
This is my first reported bug here. Sorry if I didn't follow guidelines or anything properly.
Here's the trace:
Failure/Error: puts Transaction.all.first
NoMethodError:
undefined method `merge' for "primary":String
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/mongo-2.1.0.rc0/lib/mongo/client.rb:188:in `read_preference'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/mongo-2.1.0.rc0/lib/mongo/collection.rb:93:in `read_preference'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/mongo-2.1.0.rc0/lib/mongo/collection/view/readable.rb:406:in `default_read'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/mongo-2.1.0.rc0/lib/mongo/collection/view/readable.rb:296:in `read'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/mongo-2.1.0.rc0/lib/mongo/collection/view/iterable.rb:38:in `each'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/query_cache.rb:207:in `each'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/contextual/mongo.rb:240:in `first'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/contextual/mongo.rb:240:in `block in first'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/contextual/mongo.rb:489:in `try_cache'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/contextual/mongo.rb:239:in `first'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bundler/gems/mongoid-00511658f12f/lib/mongoid/contextual.rb:20:in `first'
- ./spec/controllers/api/v1/transactions_controller.rb:24:in `block (3 levels) in <top (required)>'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `instance_exec'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `block in run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `block in with_around_and_singleton_context_hooks'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `block in with_around_example_hooks'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `block in run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:618:in `block in run_around_example_hooks_for'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-rails-3.3.3/lib/rspec/rails/example/controller_example_group.rb:190:in `block (2 levels) in <module:ControllerExampleGroup>'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:389:in `execute_with'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-rails-3.3.3/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:389:in `execute_with'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:621:in `run_around_example_hooks_for'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `with_around_example_hooks'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `with_around_and_singleton_context_hooks'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:203:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:559:in `block in run_examples'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `map'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `run_examples'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:521:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `block in run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `map'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:522:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `map'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1627:in `with_suite_hooks'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:114:in `block in run_specs'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb:77:in `report'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:113:in `run_specs'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:89:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `load'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `<main>'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
- /Users/dstldjeans/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'