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

Model.defaults returns wrong type (should be Hash but returns Array)

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.3.4
    • Affects Version/s: None
    • Component/s: None

      this commit introduced the bug : 1b77d9cf09aa43c4a284be39e5796524850715c0 ,
      and it's still wrong in master.

      in: lib/mongoid/fields.rb

      
            # Returns the default values for the fields on the document.
            #
            # @exampleGet the defaults.
            #   Person.defaults
            #
            # @return [ Hash ] The field defaults.
            def defaults
              @defaults||= []
            end
      
      

      in: spec/unit/mongoid/fields_spec.rb

      
      require "spec_helper"
      
      describe Mongoid::Fields do
      
        describe ".defaults" do
      
          it "returns a hash of all the default values" do
            Game.defaults.should eq([ "high_score", "score" ])
          end
        end
      
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            stonegao Stone, Gao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: