Refactor and spec ShellCommand