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

Fix current I18n related test failures

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • None

      There are a bunch of fallback related errors, that appear to be the result of not resetting the fallbacks to [] after setting them:

      1) Mongoid::Fields#{field}_translations when the field is localized when translations exist returns all the translations
           Failure/Error:
             expect(translations).to eq(
               { "en" => "test", "de" => "The best" }
             )
           
             expected: {"de"=>"The best", "en"=>"test"}
                  got: {"de"=>"The best", "ru"=>"test"}
           
             (compared using ==)
           
             Diff:
             @@ -1,3 +1,3 @@
              "de" => "The best",
             -"en" => "test",
             +"ru" => "test",
             
           # ./spec/mongoid/fields_spec.rb:34:in `block (5 levels) in <top (required)>'
           # ./spec/support/macros.rb:26:in `block in config_override'
                                                                                                               
        2) Mongoid::Fields localize: :present when assigning an empty string assigns the value
           Failure/Error: expect(product.title).to eq(nil)
           
             expected: nil
                  got: "hello"
           
             (compared using ==)
           # ./spec/mongoid/fields_spec.rb:2004:in `block (4 levels) in <top (required)>'
           # ./spec/support/macros.rb:26:in `block in config_override'
      
                                                                                                               
        3) Mongoid::Fields localize: :present when assigning nil assigns the value
           Failure/Error: expect(product.title).to eq(nil)
           
             expected: nil
                  got: "hello"
           
             (compared using ==)
           # ./spec/mongoid/fields_spec.rb:2027:in `block (4 levels) in <top (required)>'
           # ./spec/support/macros.rb:26:in `block in config_override'
      
                                                                                                               
        4) Mongoid::Fields localize: :present when assigning an empty array assigns the value
           Failure/Error: expect(product.title).to eq(nil)
           
             expected: nil
                  got: "hello"
           
             (compared using ==)
           # ./spec/mongoid/fields_spec.rb:2050:in `block (4 levels) in <top (required)>'
           # ./spec/support/macros.rb:26:in `block in config_override'
      

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: