File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,12 @@ def shell
73
73
expect ( $stdin) . to receive ( :gets ) . and_return ( 'n' )
74
74
expect ( shell . yes? ( "Should I overwrite it?" ) ) . not_to be_true
75
75
end
76
+
77
+ it "asks the user and returns false if the user replies with an answer other than yes or no" do
78
+ expect ( $stdout) . to receive ( :print ) . with ( "Should I overwrite it? " )
79
+ expect ( $stdin) . to receive ( :gets ) . and_return ( 'foobar' )
80
+ expect ( shell . yes? ( "Should I overwrite it?" ) ) . to be_false
81
+ end
76
82
end
77
83
78
84
describe "#no?" do
@@ -85,6 +91,12 @@ def shell
85
91
expect ( $stdin) . to receive ( :gets ) . and_return ( 'Yes' )
86
92
expect ( shell . no? ( "Should I overwrite it?" ) ) . to be_false
87
93
end
94
+
95
+ it "asks the user and returns false if the user replies with an answer other than yes or no" do
96
+ expect ( $stdout) . to receive ( :print ) . with ( "Should I overwrite it? " )
97
+ expect ( $stdin) . to receive ( :gets ) . and_return ( 'foobar' )
98
+ expect ( shell . no? ( "Should I overwrite it?" ) ) . to be_false
99
+ end
88
100
end
89
101
90
102
describe "#say" do
You can’t perform that action at this time.
0 commit comments