Use chpwd instead of preexec.

Allows 'cd foo && cmd' to see .ruby-version, as well as in subshells for
zsh.

Fixes postmodern/chruby#245.
Inherit traps within subshells to keep bash auto-switching.

Also adds tests.

Fixes postmodern/chruby#241.