Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created September 10, 2010 15:36
Show Gist options
  • Save jackdempsey/573848 to your computer and use it in GitHub Desktop.
Save jackdempsey/573848 to your computer and use it in GitHub Desktop.
diff --git a/lib/thor/shell/basic.rb b/lib/thor/shell/basic.rb
index 9235f00..b1cc146 100644
--- a/lib/thor/shell/basic.rb
+++ b/lib/thor/shell/basic.rb
@@ -69,7 +69,7 @@ class Thor
# "yes".
#
def yes?(statement, color=nil)
- ask(statement, color) =~ is?(:yes)
+ !!(ask(statement, color) =~ is?(:yes))
end
# Make a question the to user and returns true if the user replies "n" or
diff --git a/spec/shell/basic_spec.rb b/spec/shell/basic_spec.rb
index 7503758..cdf9568 100644
--- a/spec/shell/basic_spec.rb
+++ b/spec/shell/basic_spec.rb
@@ -27,7 +27,7 @@ describe Thor::Shell::Basic do
it "asks the user and returns true if the user replies yes" do
$stdout.should_receive(:print).with("Should I overwrite it? ")
$stdin.should_receive(:gets).and_return('y')
- shell.yes?("Should I overwrite it?").must be_true
+ shell.yes?("Should I overwrite it?").must === true
$stdout.should_receive(:print).with("Should I overwrite it? ")
$stdin.should_receive(:gets).and_return('n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment