mm_uses_uuid 0.0.3 → 0.0.4
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/lib/mm_uses_uuid/version.rb +1 -1
 - data/lib/mm_uses_uuid.rb +1 -1
 - data/spec/mm_uses_uuid_spec.rb +4 -1
 - metadata +3 -3
 
    
        data/lib/mm_uses_uuid/version.rb
    CHANGED
    
    
    
        data/lib/mm_uses_uuid.rb
    CHANGED
    
    | 
         @@ -41,7 +41,7 @@ module MmUsesUuid 
     | 
|
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                def new(params = {})
         
     | 
| 
       44 
     | 
    
         
            -
                  passed_id = params.delete(:id) || params.delete(:_id)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  passed_id = params.delete(:id) || params.delete(:_id) || params.delete('id') || params.delete('_id')
         
     | 
| 
       45 
45 
     | 
    
         
             
                  new_object = super(params)
         
     | 
| 
       46 
46 
     | 
    
         
             
                  if passed_id.is_a?(BSON::Binary) and passed_id.subtype == BSON::Binary::SUBTYPE_UUID
         
     | 
| 
       47 
47 
     | 
    
         
             
                    new_object.id = passed_id
         
     | 
    
        data/spec/mm_uses_uuid_spec.rb
    CHANGED
    
    | 
         @@ -46,7 +46,10 @@ describe MmUsesUuid do 
     | 
|
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
              it "should not set a new uuid if one as passed as a param" do
         
     | 
| 
       49 
     | 
    
         
            -
                group_with_passed_id = Group.new(: 
     | 
| 
      
 49 
     | 
    
         
            +
                group_with_passed_id = Group.new(:id => BSON::Binary.new("3333333333334333y333333333333333", BSON::Binary::SUBTYPE_UUID))
         
     | 
| 
      
 50 
     | 
    
         
            +
                group_with_passed_id.id.to_s.should == "3333333333334333y333333333333333"
         
     | 
| 
      
 51 
     | 
    
         
            +
                
         
     | 
| 
      
 52 
     | 
    
         
            +
                group_with_passed_id = Group.new('_id' => BSON::Binary.new("3333333333334333y333333333333333", BSON::Binary::SUBTYPE_UUID))
         
     | 
| 
       50 
53 
     | 
    
         
             
                group_with_passed_id.id.to_s.should == "3333333333334333y333333333333333"
         
     | 
| 
       51 
54 
     | 
    
         
             
              end
         
     | 
| 
       52 
55 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.0.4
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - Jonathan Chambers
         
     | 
| 
         @@ -14,7 +14,7 @@ autorequire: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       15 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            date: 2011-12- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2011-12-13 00:00:00 +00:00
         
     | 
| 
       18 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |