Enhance Word test scenarios and fix bug in word.rb