[TEST] fixes #8539 - refactoring a test to work for both GNU libc and Darwin libc

Ruby's String#crypt method relies on the libc implementation of crypt. Mac OS does it differently, thus the output hashed string has a different structure.
see http://apidock.com/ruby/String/crypt#1075-String-crypt-uses-your-platform-s-native-implementation for an example.

The workaround for this is relatively simple - if we're on a mac, expect 2 parts, otherwise, stick with the original 4. The same logic goes towards the place in the array which should be tested for updated password