fix ruby code and adapt to recommendation by betterspecs.org