Fixes bug 10628.
Merge pull request #10629 from stmpjmpr/bug_10628

Fixes bug 10628.
condition simplified
No need changelog entry
Merge branch 'fix-test_unit-railtie'

This branch is composed of #10629 and #10708

Closes #10629
Closes #10708
Fixes #10628