[CHEF-2821] simplified and with tests

http://tickets.opscode.com/browse/CHEF-2821