Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2714

Unable to change sessions

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.1.0
    • 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
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            jerryclinesmith jerryclinesmith
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: