erikhuda/thor — pull request #369 by sirbrillig (2013-11-01 17:26:09+00:00)
Title: Correct Basic#no? for misc. input

Using `Shell::Basic#no?` and `#yes?` I expect that the input of something other than 'yes' or 'no' (including just a newline) will return false. That is true for `#yes?`, but since `#no?` just mirrors the output of `#yes?` it does not correctly handle those situations.

To put it another way, `Shell::Basic#no?` is not actually testing for 'no', despite what the documentation says. It is testing for "not yes".

The documentation reads:
> Make a question the to user and returns true if the user replies “n” or “no”.

This can be a problem if, for example, you'd like to have a default behavior like this:

```
return if no? "Do you want to continue? [Y/n] "
puts "Continuing..." # If you just hit Enter above, the return is triggered, even though you did not type 'n' or 'no'.
```

I added a test to prove the bug and fixed it by just using `#ask` directly.