Fixed tests and rubocop issues