mongo_doc 0.6.22 → 0.6.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +32 -29
- data/README.textile +5 -1
- data/Rakefile +7 -7
- data/VERSION +1 -1
- data/features/connection.feature +13 -0
- data/features/step_definitions/connection_steps.rb +13 -0
- data/lib/mongo_doc/connection.rb +4 -5
- data/lib/mongo_doc/ext/code.rb +7 -0
- data/lib/mongo_doc/ext.rb +1 -0
- data/lib/mongo_doc.rb +1 -1
- data/mongo_doc.gemspec +20 -17
- data/spec/connection_spec.rb +22 -7
- metadata +15 -30
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -2,68 +2,71 @@ PATH | |
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 4 | 
             
                mongo_doc (0.6.22)
         | 
| 5 | 
            -
                  activemodel (>= 3.0.0 | 
| 6 | 
            -
                  activesupport (>= 3.0.0 | 
| 7 | 
            -
                  bson ( | 
| 8 | 
            -
                  bson_ext ( | 
| 5 | 
            +
                  activemodel (>= 3.0.0)
         | 
| 6 | 
            +
                  activesupport (>= 3.0.0)
         | 
| 7 | 
            +
                  bson (= 1.0.4)
         | 
| 8 | 
            +
                  bson_ext (= 1.0.4)
         | 
| 9 9 | 
             
                  mongo (>= 1.0.0)
         | 
| 10 10 | 
             
                  tzinfo (>= 0.3.22)
         | 
| 11 11 |  | 
| 12 12 | 
             
            GEM
         | 
| 13 13 | 
             
              remote: http://rubygems.org/
         | 
| 14 14 | 
             
              specs:
         | 
| 15 | 
            -
                activemodel (3.0.0 | 
| 16 | 
            -
                  activesupport (= 3.0.0 | 
| 15 | 
            +
                activemodel (3.0.0)
         | 
| 16 | 
            +
                  activesupport (= 3.0.0)
         | 
| 17 17 | 
             
                  builder (~> 2.1.2)
         | 
| 18 18 | 
             
                  i18n (~> 0.4.1)
         | 
| 19 | 
            -
                activesupport (3.0.0 | 
| 19 | 
            +
                activesupport (3.0.0)
         | 
| 20 20 | 
             
                bson (1.0.4)
         | 
| 21 21 | 
             
                bson_ext (1.0.4)
         | 
| 22 22 | 
             
                builder (2.1.2)
         | 
| 23 | 
            -
                cucumber (0. | 
| 23 | 
            +
                cucumber (0.9.2)
         | 
| 24 24 | 
             
                  builder (~> 2.1.2)
         | 
| 25 25 | 
             
                  diff-lcs (~> 1.1.2)
         | 
| 26 | 
            -
                  gherkin (~> 2. | 
| 27 | 
            -
                   | 
| 28 | 
            -
                  term-ansicolor (~> 1.0. | 
| 26 | 
            +
                  gherkin (~> 2.2.5)
         | 
| 27 | 
            +
                  json (~> 1.4.6)
         | 
| 28 | 
            +
                  term-ansicolor (~> 1.0.5)
         | 
| 29 29 | 
             
                diff-lcs (1.1.2)
         | 
| 30 30 | 
             
                gemcutter (0.6.1)
         | 
| 31 | 
            -
                gherkin (2. | 
| 32 | 
            -
                   | 
| 31 | 
            +
                gherkin (2.2.8)
         | 
| 32 | 
            +
                  json (~> 1.4.6)
         | 
| 33 | 
            +
                  term-ansicolor (~> 1.0.5)
         | 
| 33 34 | 
             
                git (1.2.5)
         | 
| 34 35 | 
             
                i18n (0.4.1)
         | 
| 35 36 | 
             
                jeweler (1.4.0)
         | 
| 36 37 | 
             
                  gemcutter (>= 0.1.0)
         | 
| 37 38 | 
             
                  git (>= 1.2.5)
         | 
| 38 39 | 
             
                  rubyforge (>= 2.0.0)
         | 
| 39 | 
            -
                 | 
| 40 | 
            -
                 | 
| 40 | 
            +
                json (1.4.6)
         | 
| 41 | 
            +
                json_pure (1.4.6)
         | 
| 42 | 
            +
                mongo (1.0.7)
         | 
| 41 43 | 
             
                  bson (>= 1.0.4)
         | 
| 42 | 
            -
                rspec (2.0.0 | 
| 43 | 
            -
                  rspec-core (= 2.0.0 | 
| 44 | 
            -
                  rspec-expectations (= 2.0.0 | 
| 45 | 
            -
                  rspec-mocks (= 2.0.0 | 
| 46 | 
            -
                rspec-core (2.0.0 | 
| 47 | 
            -
                rspec-expectations (2.0.0 | 
| 44 | 
            +
                rspec (2.0.0)
         | 
| 45 | 
            +
                  rspec-core (= 2.0.0)
         | 
| 46 | 
            +
                  rspec-expectations (= 2.0.0)
         | 
| 47 | 
            +
                  rspec-mocks (= 2.0.0)
         | 
| 48 | 
            +
                rspec-core (2.0.0)
         | 
| 49 | 
            +
                rspec-expectations (2.0.0)
         | 
| 48 50 | 
             
                  diff-lcs (>= 1.1.2)
         | 
| 49 | 
            -
                rspec-mocks (2.0.0 | 
| 51 | 
            +
                rspec-mocks (2.0.0)
         | 
| 52 | 
            +
                  rspec-core (= 2.0.0)
         | 
| 53 | 
            +
                  rspec-expectations (= 2.0.0)
         | 
| 50 54 | 
             
                rubyforge (2.0.4)
         | 
| 51 55 | 
             
                  json_pure (>= 1.1.7)
         | 
| 52 56 | 
             
                term-ansicolor (1.0.5)
         | 
| 53 | 
            -
                 | 
| 54 | 
            -
                tzinfo (0.3.22)
         | 
| 57 | 
            +
                tzinfo (0.3.23)
         | 
| 55 58 |  | 
| 56 59 | 
             
            PLATFORMS
         | 
| 57 60 | 
             
              ruby
         | 
| 58 61 |  | 
| 59 62 | 
             
            DEPENDENCIES
         | 
| 60 | 
            -
              activemodel (>= 3.0.0 | 
| 61 | 
            -
              activesupport (>= 3.0.0 | 
| 62 | 
            -
              bson ( | 
| 63 | 
            -
              bson_ext ( | 
| 63 | 
            +
              activemodel (>= 3.0.0)
         | 
| 64 | 
            +
              activesupport (>= 3.0.0)
         | 
| 65 | 
            +
              bson (= 1.0.4)
         | 
| 66 | 
            +
              bson_ext (= 1.0.4)
         | 
| 64 67 | 
             
              cucumber (>= 0.8.5)
         | 
| 65 68 | 
             
              jeweler (>= 1.4.0)
         | 
| 66 69 | 
             
              mongo (>= 1.0.0)
         | 
| 67 70 | 
             
              mongo_doc!
         | 
| 68 | 
            -
              rspec (>= 2.0.0 | 
| 71 | 
            +
              rspec (>= 2.0.0)
         | 
| 69 72 | 
             
              tzinfo (>= 0.3.22)
         | 
    
        data/README.textile
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            h1. MongoDoc
         | 
| 2 2 |  | 
| 3 | 
            -
            Version: 0.6. | 
| 3 | 
            +
            Version: 0.6.23 2010/10/13
         | 
| 4 4 |  | 
| 5 5 | 
             
            h2. Notes
         | 
| 6 6 |  | 
| @@ -156,6 +156,10 @@ Finally, if you do not want to use the database configuration file, you can also | |
| 156 156 |  | 
| 157 157 | 
             
            bc. MongoDoc::Connection.name = 'stats'
         | 
| 158 158 |  | 
| 159 | 
            +
            And if that is not enough control,  perhaps you are using authentication, just set the connection directly:
         | 
| 160 | 
            +
             | 
| 161 | 
            +
            bc. MongoDoc::Connection.connection = Mongo::Connection.from_uri("mongodb://user:password@localhost/db")
         | 
| 162 | 
            +
             | 
| 159 163 | 
             
            h2. Cleaning the database during testing
         | 
| 160 164 |  | 
| 161 165 | 
             
            When testing you may need to clean up and return the database to an empty state. @MongoDoc::DatabaseCleaner.clean_database@ is a helper that can be used to do this, for example with @RSpec@ (note the @require@):
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -4,21 +4,21 @@ begin | |
| 4 4 | 
             
              require 'jeweler'
         | 
| 5 5 | 
             
              Jeweler::Tasks.new do |gem|
         | 
| 6 6 | 
             
                gem.name = "mongo_doc"
         | 
| 7 | 
            -
                gem.summary =  | 
| 8 | 
            -
                gem.description =  | 
| 7 | 
            +
                gem.summary = "ODM for MongoDB"
         | 
| 8 | 
            +
                gem.description = "ODM for MongoDB"
         | 
| 9 9 | 
             
                gem.email = "leshill@gmail.com"
         | 
| 10 10 | 
             
                gem.homepage = "http://github.com/leshill/mongodoc"
         | 
| 11 11 | 
             
                gem.authors = ["Les Hill"]
         | 
| 12 12 | 
             
                gem.files.include('lib/**/*.task')
         | 
| 13 | 
            -
                gem.add_dependency "activesupport", ">= 3.0.0 | 
| 14 | 
            -
                gem.add_dependency "activemodel", ">=3.0.0 | 
| 15 | 
            -
                gem.add_dependency "bson", " | 
| 16 | 
            -
                gem.add_dependency "bson_ext", " | 
| 13 | 
            +
                gem.add_dependency "activesupport", ">= 3.0.0"
         | 
| 14 | 
            +
                gem.add_dependency "activemodel", ">=3.0.0"
         | 
| 15 | 
            +
                gem.add_dependency "bson", "= 1.0.4"
         | 
| 16 | 
            +
                gem.add_dependency "bson_ext", "= 1.0.4"
         | 
| 17 17 | 
             
                gem.add_dependency "mongo", ">= 1.0.0"
         | 
| 18 18 | 
             
                gem.add_dependency "tzinfo", ">= 0.3.22"
         | 
| 19 19 | 
             
                gem.add_development_dependency "cucumber", ">= 0.8.5"
         | 
| 20 20 | 
             
                gem.add_development_dependency "jeweler", ">= 1.4.0"
         | 
| 21 | 
            -
                gem.add_development_dependency "rspec", ">= 2.0.0 | 
| 21 | 
            +
                gem.add_development_dependency "rspec", ">= 2.0.0"
         | 
| 22 22 | 
             
                # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
         | 
| 23 23 | 
             
              end
         | 
| 24 24 | 
             
              Jeweler::GemcutterTasks.new
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.6. | 
| 1 | 
            +
            0.6.23
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            Feature: Setting a Connection Manually
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              Scenario: Setting the connection manually
         | 
| 4 | 
            +
                Given a new connection to the database "with_auth" with user "test" and password "test"
         | 
| 5 | 
            +
                And a new collection named 'test'
         | 
| 6 | 
            +
                And an object 'movie'
         | 
| 7 | 
            +
                When I save the object 'movie'
         | 
| 8 | 
            +
                And I query the collection 'test' with the criteria where(:title => 'Gone with the Wind')
         | 
| 9 | 
            +
                Then the query result has 1 documents
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              Scenario: Failing auth with manual connection
         | 
| 12 | 
            +
                When a new connection to the database "with_auth" with user "test" and password "bad"
         | 
| 13 | 
            +
                Then a "Mongo::AuthenticationError" exception is thrown
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            Given /^a new connection to the database "([^"]*)" with user "([^"]*)" and password "([^"]*)"$/ do |db, user, password|
         | 
| 2 | 
            +
              begin
         | 
| 3 | 
            +
                MongoDoc::Connection.connection = Mongo::Connection.from_uri("mongodb://#{user}:#{password}@localhost/#{db}")
         | 
| 4 | 
            +
                MongoDoc::Connection.send(:verify_server_version)
         | 
| 5 | 
            +
              rescue StandardError => e
         | 
| 6 | 
            +
                @exception = e
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            Then /^a "([^"]*)" exception is thrown$/ do |exception|
         | 
| 11 | 
            +
              @exception.class.name.should == exception
         | 
| 12 | 
            +
            end
         | 
| 13 | 
            +
             | 
    
        data/lib/mongo_doc/connection.rb
    CHANGED
    
    | @@ -6,7 +6,7 @@ module MongoDoc | |
| 6 6 |  | 
| 7 7 | 
             
                extend self
         | 
| 8 8 |  | 
| 9 | 
            -
                attr_writer :config_path, :default_name, :env, :host, :name, :options, :port, :strict
         | 
| 9 | 
            +
                attr_writer :config_path, :connection, :default_name, :env, :host, :name, :options, :port, :strict
         | 
| 10 10 |  | 
| 11 11 | 
             
                def config_path
         | 
| 12 12 | 
             
                  @config_path || './mongodb.yml'
         | 
| @@ -55,13 +55,12 @@ module MongoDoc | |
| 55 55 | 
             
                private
         | 
| 56 56 |  | 
| 57 57 | 
             
                def connect
         | 
| 58 | 
            -
                  connection = Mongo::Connection.new(host, port, options)
         | 
| 59 | 
            -
                   | 
| 60 | 
            -
                  verify_server_version(connection)
         | 
| 58 | 
            +
                  self.connection = Mongo::Connection.new(host, port, options) || (raise NoConnectionError.new)
         | 
| 59 | 
            +
                  verify_server_version
         | 
| 61 60 | 
             
                  connection
         | 
| 62 61 | 
             
                end
         | 
| 63 62 |  | 
| 64 | 
            -
                def verify_server_version | 
| 63 | 
            +
                def verify_server_version
         | 
| 65 64 | 
             
                  raise UnsupportedServerVersionError.new('MongoDoc requires at least mongoDB version 1.4.0') unless connection.server_version >= "1.4.0"
         | 
| 66 65 | 
             
                end
         | 
| 67 66 | 
             
              end
         | 
    
        data/lib/mongo_doc/ext.rb
    CHANGED
    
    
    
        data/lib/mongo_doc.rb
    CHANGED
    
    
    
        data/mongo_doc.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{mongo_doc}
         | 
| 8 | 
            -
              s.version = "0.6. | 
| 8 | 
            +
              s.version = "0.6.23"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Les Hill"]
         | 
| 12 | 
            -
              s.date = %q{2010- | 
| 12 | 
            +
              s.date = %q{2010-10-14}
         | 
| 13 13 | 
             
              s.description = %q{ODM for MongoDB}
         | 
| 14 14 | 
             
              s.email = %q{leshill@gmail.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -32,6 +32,7 @@ Gem::Specification.new do |s| | |
| 32 32 | 
             
                 "examples/simple_document.rb",
         | 
| 33 33 | 
             
                 "examples/simple_object.rb",
         | 
| 34 34 | 
             
                 "features/collections.feature",
         | 
| 35 | 
            +
                 "features/connection.feature",
         | 
| 35 36 | 
             
                 "features/db_references.feature",
         | 
| 36 37 | 
             
                 "features/embed_hash.feature",
         | 
| 37 38 | 
             
                 "features/finders.feature",
         | 
| @@ -46,6 +47,7 @@ Gem::Specification.new do |s| | |
| 46 47 | 
             
                 "features/saving_an_object.feature",
         | 
| 47 48 | 
             
                 "features/scopes.feature",
         | 
| 48 49 | 
             
                 "features/step_definitions/collection_steps.rb",
         | 
| 50 | 
            +
                 "features/step_definitions/connection_steps.rb",
         | 
| 49 51 | 
             
                 "features/step_definitions/document_steps.rb",
         | 
| 50 52 | 
             
                 "features/step_definitions/documents.rb",
         | 
| 51 53 | 
             
                 "features/step_definitions/embed_hash_steps.rb",
         | 
| @@ -86,6 +88,7 @@ Gem::Specification.new do |s| | |
| 86 88 | 
             
                 "lib/mongo_doc/ext/array.rb",
         | 
| 87 89 | 
             
                 "lib/mongo_doc/ext/binary.rb",
         | 
| 88 90 | 
             
                 "lib/mongo_doc/ext/boolean_class.rb",
         | 
| 91 | 
            +
                 "lib/mongo_doc/ext/code.rb",
         | 
| 89 92 | 
             
                 "lib/mongo_doc/ext/date.rb",
         | 
| 90 93 | 
             
                 "lib/mongo_doc/ext/date_time.rb",
         | 
| 91 94 | 
             
                 "lib/mongo_doc/ext/dbref.rb",
         | 
| @@ -234,36 +237,36 @@ Gem::Specification.new do |s| | |
| 234 237 | 
             
                s.specification_version = 3
         | 
| 235 238 |  | 
| 236 239 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 237 | 
            -
                  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0 | 
| 238 | 
            -
                  s.add_runtime_dependency(%q<activemodel>, [">= 3.0.0 | 
| 239 | 
            -
                  s.add_runtime_dependency(%q<bson>, [" | 
| 240 | 
            -
                  s.add_runtime_dependency(%q<bson_ext>, [" | 
| 240 | 
            +
                  s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
         | 
| 241 | 
            +
                  s.add_runtime_dependency(%q<activemodel>, [">= 3.0.0"])
         | 
| 242 | 
            +
                  s.add_runtime_dependency(%q<bson>, ["= 1.0.4"])
         | 
| 243 | 
            +
                  s.add_runtime_dependency(%q<bson_ext>, ["= 1.0.4"])
         | 
| 241 244 | 
             
                  s.add_runtime_dependency(%q<mongo>, [">= 1.0.0"])
         | 
| 242 245 | 
             
                  s.add_runtime_dependency(%q<tzinfo>, [">= 0.3.22"])
         | 
| 243 246 | 
             
                  s.add_development_dependency(%q<cucumber>, [">= 0.8.5"])
         | 
| 244 247 | 
             
                  s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
         | 
| 245 | 
            -
                  s.add_development_dependency(%q<rspec>, [">= 2.0.0 | 
| 248 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
         | 
| 246 249 | 
             
                else
         | 
| 247 | 
            -
                  s.add_dependency(%q<activesupport>, [">= 3.0.0 | 
| 248 | 
            -
                  s.add_dependency(%q<activemodel>, [">= 3.0.0 | 
| 249 | 
            -
                  s.add_dependency(%q<bson>, [" | 
| 250 | 
            -
                  s.add_dependency(%q<bson_ext>, [" | 
| 250 | 
            +
                  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
         | 
| 251 | 
            +
                  s.add_dependency(%q<activemodel>, [">= 3.0.0"])
         | 
| 252 | 
            +
                  s.add_dependency(%q<bson>, ["= 1.0.4"])
         | 
| 253 | 
            +
                  s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
         | 
| 251 254 | 
             
                  s.add_dependency(%q<mongo>, [">= 1.0.0"])
         | 
| 252 255 | 
             
                  s.add_dependency(%q<tzinfo>, [">= 0.3.22"])
         | 
| 253 256 | 
             
                  s.add_dependency(%q<cucumber>, [">= 0.8.5"])
         | 
| 254 257 | 
             
                  s.add_dependency(%q<jeweler>, [">= 1.4.0"])
         | 
| 255 | 
            -
                  s.add_dependency(%q<rspec>, [">= 2.0.0 | 
| 258 | 
            +
                  s.add_dependency(%q<rspec>, [">= 2.0.0"])
         | 
| 256 259 | 
             
                end
         | 
| 257 260 | 
             
              else
         | 
| 258 | 
            -
                s.add_dependency(%q<activesupport>, [">= 3.0.0 | 
| 259 | 
            -
                s.add_dependency(%q<activemodel>, [">= 3.0.0 | 
| 260 | 
            -
                s.add_dependency(%q<bson>, [" | 
| 261 | 
            -
                s.add_dependency(%q<bson_ext>, [" | 
| 261 | 
            +
                s.add_dependency(%q<activesupport>, [">= 3.0.0"])
         | 
| 262 | 
            +
                s.add_dependency(%q<activemodel>, [">= 3.0.0"])
         | 
| 263 | 
            +
                s.add_dependency(%q<bson>, ["= 1.0.4"])
         | 
| 264 | 
            +
                s.add_dependency(%q<bson_ext>, ["= 1.0.4"])
         | 
| 262 265 | 
             
                s.add_dependency(%q<mongo>, [">= 1.0.0"])
         | 
| 263 266 | 
             
                s.add_dependency(%q<tzinfo>, [">= 0.3.22"])
         | 
| 264 267 | 
             
                s.add_dependency(%q<cucumber>, [">= 0.8.5"])
         | 
| 265 268 | 
             
                s.add_dependency(%q<jeweler>, [">= 1.4.0"])
         | 
| 266 | 
            -
                s.add_dependency(%q<rspec>, [">= 2.0.0 | 
| 269 | 
            +
                s.add_dependency(%q<rspec>, [">= 2.0.0"])
         | 
| 267 270 | 
             
              end
         | 
| 268 271 | 
             
            end
         | 
| 269 272 |  | 
    
        data/spec/connection_spec.rb
    CHANGED
    
    | @@ -21,6 +21,19 @@ end | |
| 21 21 |  | 
| 22 22 | 
             
            describe "MongoDoc::Connection.Connections" do
         | 
| 23 23 |  | 
| 24 | 
            +
              before do
         | 
| 25 | 
            +
                MongoDoc::Connection.reset
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              describe "#connection" do
         | 
| 29 | 
            +
                let(:conn) { mock }
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                it "allows the connection to be set" do
         | 
| 32 | 
            +
                  MongoDoc::Connection.connection = conn
         | 
| 33 | 
            +
                  MongoDoc::Connection.connection.should == conn
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 24 37 | 
             
              context "Non-rails environment" do
         | 
| 25 38 |  | 
| 26 39 | 
             
                it "does not see Rails" do
         | 
| @@ -35,7 +48,6 @@ describe "MongoDoc::Connection.Connections" do | |
| 35 48 | 
             
                  let(:connection) { stub('connection') }
         | 
| 36 49 |  | 
| 37 50 | 
             
                  before do
         | 
| 38 | 
            -
                    MongoDoc::Connection.reset
         | 
| 39 51 | 
             
                    MongoDoc::Connection.stub(:connect).and_return(connection)
         | 
| 40 52 | 
             
                  end
         | 
| 41 53 |  | 
| @@ -92,7 +104,6 @@ describe "MongoDoc::Connection.Connections" do | |
| 92 104 | 
             
                  let(:connection) { stub('connection') }
         | 
| 93 105 |  | 
| 94 106 | 
             
                  before do
         | 
| 95 | 
            -
                    MongoDoc::Connection.reset
         | 
| 96 107 | 
             
                    MongoDoc::Connection.stub(:connect).and_return(connection)
         | 
| 97 108 | 
             
                  end
         | 
| 98 109 |  | 
| @@ -111,14 +122,18 @@ describe "MongoDoc::Connection.Connections" do | |
| 111 122 | 
             
              context ".verify_server_version" do
         | 
| 112 123 | 
             
                let(:connection) { stub('connection') }
         | 
| 113 124 |  | 
| 125 | 
            +
                before do
         | 
| 126 | 
            +
                  MongoDoc::Connection.connection = connection
         | 
| 127 | 
            +
                end
         | 
| 128 | 
            +
             | 
| 114 129 | 
             
                it "raises when the server version is unsupported" do
         | 
| 115 130 | 
             
                  connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.3.4'))
         | 
| 116 | 
            -
                  lambda { MongoDoc::Connection.send(:verify_server_version | 
| 131 | 
            +
                  lambda { MongoDoc::Connection.send(:verify_server_version) }.should raise_error(MongoDoc::UnsupportedServerVersionError)
         | 
| 117 132 | 
             
                end
         | 
| 118 133 |  | 
| 119 134 | 
             
                it "returns when the server version is supported" do
         | 
| 120 135 | 
             
                  connection.stub(:server_version).and_return(Mongo::ServerVersion.new('1.4.0'))
         | 
| 121 | 
            -
                  lambda { MongoDoc::Connection.send(:verify_server_version | 
| 136 | 
            +
                  lambda { MongoDoc::Connection.send(:verify_server_version) }.should_not raise_error(MongoDoc::UnsupportedServerVersionError)
         | 
| 122 137 | 
             
                end
         | 
| 123 138 | 
             
              end
         | 
| 124 139 |  | 
| @@ -133,9 +148,9 @@ describe "MongoDoc::Connection.Connections" do | |
| 133 148 | 
             
                  host = 'host'
         | 
| 134 149 | 
             
                  port = 'port'
         | 
| 135 150 | 
             
                  options = 'options'
         | 
| 136 | 
            -
                  MongoDoc::Connection. | 
| 137 | 
            -
                  MongoDoc::Connection. | 
| 138 | 
            -
                  MongoDoc::Connection. | 
| 151 | 
            +
                  MongoDoc::Connection.host = host
         | 
| 152 | 
            +
                  MongoDoc::Connection.port = port
         | 
| 153 | 
            +
                  MongoDoc::Connection.options = options
         | 
| 139 154 | 
             
                  Mongo::Connection.should_receive(:new).with(host, port, options).and_return(connection)
         | 
| 140 155 | 
             
                  MongoDoc::Connection.send(:connect)
         | 
| 141 156 | 
             
                end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,12 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: mongo_doc
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash: 43
         | 
| 5 4 | 
             
              prerelease: false
         | 
| 6 5 | 
             
              segments: 
         | 
| 7 6 | 
             
              - 0
         | 
| 8 7 | 
             
              - 6
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.6. | 
| 8 | 
            +
              - 23
         | 
| 9 | 
            +
              version: 0.6.23
         | 
| 11 10 | 
             
            platform: ruby
         | 
| 12 11 | 
             
            authors: 
         | 
| 13 12 | 
             
            - Les Hill
         | 
| @@ -15,7 +14,7 @@ autorequire: | |
| 15 14 | 
             
            bindir: bin
         | 
| 16 15 | 
             
            cert_chain: []
         | 
| 17 16 |  | 
| 18 | 
            -
            date: 2010- | 
| 17 | 
            +
            date: 2010-10-14 00:00:00 -04:00
         | 
| 19 18 | 
             
            default_executable: 
         | 
| 20 19 | 
             
            dependencies: 
         | 
| 21 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -26,14 +25,11 @@ dependencies: | |
| 26 25 | 
             
                requirements: 
         | 
| 27 26 | 
             
                - - ">="
         | 
| 28 27 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 29 | 
            -
                    hash: 62196427
         | 
| 30 28 | 
             
                    segments: 
         | 
| 31 29 | 
             
                    - 3
         | 
| 32 30 | 
             
                    - 0
         | 
| 33 31 | 
             
                    - 0
         | 
| 34 | 
            -
                     | 
| 35 | 
            -
                    - 4
         | 
| 36 | 
            -
                    version: 3.0.0.beta.4
         | 
| 32 | 
            +
                    version: 3.0.0
         | 
| 37 33 | 
             
              type: :runtime
         | 
| 38 34 | 
             
              version_requirements: *id001
         | 
| 39 35 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -44,14 +40,11 @@ dependencies: | |
| 44 40 | 
             
                requirements: 
         | 
| 45 41 | 
             
                - - ">="
         | 
| 46 42 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 47 | 
            -
                    hash: 62196427
         | 
| 48 43 | 
             
                    segments: 
         | 
| 49 44 | 
             
                    - 3
         | 
| 50 45 | 
             
                    - 0
         | 
| 51 46 | 
             
                    - 0
         | 
| 52 | 
            -
                     | 
| 53 | 
            -
                    - 4
         | 
| 54 | 
            -
                    version: 3.0.0.beta.4
         | 
| 47 | 
            +
                    version: 3.0.0
         | 
| 55 48 | 
             
              type: :runtime
         | 
| 56 49 | 
             
              version_requirements: *id002
         | 
| 57 50 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -60,14 +53,13 @@ dependencies: | |
| 60 53 | 
             
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 61 54 | 
             
                none: false
         | 
| 62 55 | 
             
                requirements: 
         | 
| 63 | 
            -
                - - " | 
| 56 | 
            +
                - - "="
         | 
| 64 57 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 65 | 
            -
                    hash: 23
         | 
| 66 58 | 
             
                    segments: 
         | 
| 67 59 | 
             
                    - 1
         | 
| 68 60 | 
             
                    - 0
         | 
| 69 | 
            -
                    -  | 
| 70 | 
            -
                    version: 1.0. | 
| 61 | 
            +
                    - 4
         | 
| 62 | 
            +
                    version: 1.0.4
         | 
| 71 63 | 
             
              type: :runtime
         | 
| 72 64 | 
             
              version_requirements: *id003
         | 
| 73 65 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -76,14 +68,13 @@ dependencies: | |
| 76 68 | 
             
              requirement: &id004 !ruby/object:Gem::Requirement 
         | 
| 77 69 | 
             
                none: false
         | 
| 78 70 | 
             
                requirements: 
         | 
| 79 | 
            -
                - - " | 
| 71 | 
            +
                - - "="
         | 
| 80 72 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 81 | 
            -
                    hash: 23
         | 
| 82 73 | 
             
                    segments: 
         | 
| 83 74 | 
             
                    - 1
         | 
| 84 75 | 
             
                    - 0
         | 
| 85 | 
            -
                    -  | 
| 86 | 
            -
                    version: 1.0. | 
| 76 | 
            +
                    - 4
         | 
| 77 | 
            +
                    version: 1.0.4
         | 
| 87 78 | 
             
              type: :runtime
         | 
| 88 79 | 
             
              version_requirements: *id004
         | 
| 89 80 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -94,7 +85,6 @@ dependencies: | |
| 94 85 | 
             
                requirements: 
         | 
| 95 86 | 
             
                - - ">="
         | 
| 96 87 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 97 | 
            -
                    hash: 23
         | 
| 98 88 | 
             
                    segments: 
         | 
| 99 89 | 
             
                    - 1
         | 
| 100 90 | 
             
                    - 0
         | 
| @@ -110,7 +100,6 @@ dependencies: | |
| 110 100 | 
             
                requirements: 
         | 
| 111 101 | 
             
                - - ">="
         | 
| 112 102 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 113 | 
            -
                    hash: 63
         | 
| 114 103 | 
             
                    segments: 
         | 
| 115 104 | 
             
                    - 0
         | 
| 116 105 | 
             
                    - 3
         | 
| @@ -126,7 +115,6 @@ dependencies: | |
| 126 115 | 
             
                requirements: 
         | 
| 127 116 | 
             
                - - ">="
         | 
| 128 117 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 129 | 
            -
                    hash: 53
         | 
| 130 118 | 
             
                    segments: 
         | 
| 131 119 | 
             
                    - 0
         | 
| 132 120 | 
             
                    - 8
         | 
| @@ -142,7 +130,6 @@ dependencies: | |
| 142 130 | 
             
                requirements: 
         | 
| 143 131 | 
             
                - - ">="
         | 
| 144 132 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 145 | 
            -
                    hash: 7
         | 
| 146 133 | 
             
                    segments: 
         | 
| 147 134 | 
             
                    - 1
         | 
| 148 135 | 
             
                    - 4
         | 
| @@ -158,14 +145,11 @@ dependencies: | |
| 158 145 | 
             
                requirements: 
         | 
| 159 146 | 
             
                - - ">="
         | 
| 160 147 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 161 | 
            -
                    hash: 62196423
         | 
| 162 148 | 
             
                    segments: 
         | 
| 163 149 | 
             
                    - 2
         | 
| 164 150 | 
             
                    - 0
         | 
| 165 151 | 
             
                    - 0
         | 
| 166 | 
            -
                     | 
| 167 | 
            -
                    - 18
         | 
| 168 | 
            -
                    version: 2.0.0.beta.18
         | 
| 152 | 
            +
                    version: 2.0.0
         | 
| 169 153 | 
             
              type: :development
         | 
| 170 154 | 
             
              version_requirements: *id009
         | 
| 171 155 | 
             
            description: ODM for MongoDB
         | 
| @@ -193,6 +177,7 @@ files: | |
| 193 177 | 
             
            - examples/simple_document.rb
         | 
| 194 178 | 
             
            - examples/simple_object.rb
         | 
| 195 179 | 
             
            - features/collections.feature
         | 
| 180 | 
            +
            - features/connection.feature
         | 
| 196 181 | 
             
            - features/db_references.feature
         | 
| 197 182 | 
             
            - features/embed_hash.feature
         | 
| 198 183 | 
             
            - features/finders.feature
         | 
| @@ -207,6 +192,7 @@ files: | |
| 207 192 | 
             
            - features/saving_an_object.feature
         | 
| 208 193 | 
             
            - features/scopes.feature
         | 
| 209 194 | 
             
            - features/step_definitions/collection_steps.rb
         | 
| 195 | 
            +
            - features/step_definitions/connection_steps.rb
         | 
| 210 196 | 
             
            - features/step_definitions/document_steps.rb
         | 
| 211 197 | 
             
            - features/step_definitions/documents.rb
         | 
| 212 198 | 
             
            - features/step_definitions/embed_hash_steps.rb
         | 
| @@ -247,6 +233,7 @@ files: | |
| 247 233 | 
             
            - lib/mongo_doc/ext/array.rb
         | 
| 248 234 | 
             
            - lib/mongo_doc/ext/binary.rb
         | 
| 249 235 | 
             
            - lib/mongo_doc/ext/boolean_class.rb
         | 
| 236 | 
            +
            - lib/mongo_doc/ext/code.rb
         | 
| 250 237 | 
             
            - lib/mongo_doc/ext/date.rb
         | 
| 251 238 | 
             
            - lib/mongo_doc/ext/date_time.rb
         | 
| 252 239 | 
             
            - lib/mongo_doc/ext/dbref.rb
         | 
| @@ -355,7 +342,6 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 355 342 | 
             
              requirements: 
         | 
| 356 343 | 
             
              - - ">="
         | 
| 357 344 | 
             
                - !ruby/object:Gem::Version 
         | 
| 358 | 
            -
                  hash: 3
         | 
| 359 345 | 
             
                  segments: 
         | 
| 360 346 | 
             
                  - 0
         | 
| 361 347 | 
             
                  version: "0"
         | 
| @@ -364,7 +350,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 364 350 | 
             
              requirements: 
         | 
| 365 351 | 
             
              - - ">="
         | 
| 366 352 | 
             
                - !ruby/object:Gem::Version 
         | 
| 367 | 
            -
                  hash: 3
         | 
| 368 353 | 
             
                  segments: 
         | 
| 369 354 | 
             
                  - 0
         | 
| 370 355 | 
             
                  version: "0"
         |