Skip to content
  • Bogdan Denkovych's avatar
    Do not `eager_load` by default in the test environment · 2d1eacec
    Bogdan Denkovych authored
    Usually, developers run a single test locally.
    Disabling eager loading by default in test environment should increase
    productivity since it saves around 10 seconds:
    
    With `eager_load` as `true`:
    ```bash
    bogdanvlviv@lenovo:~/gitlab-development-kit/gitlab$ bin/rspec spec/models/users_statistics_spec.rb
    Run options: include {:focus=>true}
    
    All examples were filtered out; ignoring {:focus=>true}
    
    Test environment set up in 5.122837013 seconds
    ......
    
    Finished in 8.51 seconds (files took 16.46 seconds to load)
    6 examples, 0 failures
    ```
    
    With `eager_load` as `false`:
    ```bash
    bogdanvlviv@lenovo:~/gitlab-development-kit/gitlab$ bin/rspec spec/models/users_statistics_spec.rb
    Run options: include {:focus=>true}
    
    All examples were filtered out; ignoring {:focus=>true}
    
    Test environment set up in 5.013345478 seconds
    ......
    
    Finished in 8.24 seconds (files took 7.18 seconds to load)
    6 examples, 0 failures
    ```
    
    Inspired by https://github.com/rails/rails/pull/43508...
    2d1eacec