Test that captures hash type validation

Also made the check more ruby-ish