-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Using Mongoid 3.0.17 and Ruby 1.9.3, changing sessions doesn't seem to be working. I've looked at the website and Mongoid specs and I think my syntax is correct, but the session never seems to change.
Mongoid.yml:
test: sessions: default: uri: mongodb://localhost:27017/crucible_test options: safe: true consistency: :strong skip_version_check: true client1: uri: mongodb://localhost:27017/crucible_integration client2: uri: mongodb://localhost:27017/crucible_development
Spec:
describe "Mongoid" do it "should switch sessions" do Member.database_name.should eq "crucible_test" Mongoid.override_session :client1 Member.database_name.should eq "crucible_integration" Mongoid.override_session :client2 Member.database_name.should eq "crucible_development" Mongoid.override_session nil Member.database_name.should eq "crucible_test" end end