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

Unable to change sessions

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 3.1.0
    • Component/s: None
    • Labels:
      None

      Description

      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
      

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: