@@ -31,27 +31,27 @@ def shell
31
31
32
32
33
33
it "prints a message to the user with the available options and determines the correctness of the answer" do
34
- $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [" strawberry", " chocolate", " vanilla" ] ' )
34
+ $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [strawberry, chocolate, vanilla] ' )
35
35
$stdin. should_receive ( :gets ) . and_return ( 'chocolate' )
36
36
expect ( shell . ask ( "What's your favorite Neopolitan flavor?" , :limited_to => [ "strawberry" , "chocolate" , "vanilla" ] ) ) . to eq ( "chocolate" )
37
37
end
38
38
39
39
it "prints a message to the user with the available options and reasks the question after an incorrect repsonse" do
40
- $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [" strawberry", " chocolate", " vanilla" ] ' ) . twice
41
- $stdout. should_receive ( :puts ) . with ( 'Your response must be one of: [" strawberry", " chocolate", " vanilla" ]. Please try again.' )
40
+ $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [strawberry, chocolate, vanilla] ' ) . twice
41
+ $stdout. should_receive ( :puts ) . with ( 'Your response must be one of: [strawberry, chocolate, vanilla]. Please try again.' )
42
42
$stdin. should_receive ( :gets ) . and_return ( 'moose tracks' , 'chocolate' )
43
43
expect ( shell . ask ( "What's your favorite Neopolitan flavor?" , :limited_to => [ "strawberry" , "chocolate" , "vanilla" ] ) ) . to eq ( "chocolate" )
44
44
end
45
45
46
46
it "prints a message to the user containing a default and sets the default if only enter is pressed" do
47
- $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? (" vanilla" ) ' )
47
+ $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? (vanilla) ' )
48
48
$stdin. should_receive ( :gets ) . and_return ( '' )
49
49
expect ( shell . ask ( "What's your favorite Neopolitan flavor?" , :default => "vanilla" ) ) . to eq ( "vanilla" )
50
50
end
51
51
52
52
it "prints a message to the user with the available options and reasks the question after an incorrect repsonse and then returns the default" do
53
- $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [" strawberry", " chocolate", " vanilla" ] (" vanilla" ) ' ) . twice
54
- $stdout. should_receive ( :puts ) . with ( 'Your response must be one of: [" strawberry", " chocolate", " vanilla" ]. Please try again.' )
53
+ $stdout. should_receive ( :print ) . with ( 'What\'s your favorite Neopolitan flavor? [strawberry, chocolate, vanilla] (vanilla) ' ) . twice
54
+ $stdout. should_receive ( :puts ) . with ( 'Your response must be one of: [strawberry, chocolate, vanilla]. Please try again.' )
55
55
$stdin. should_receive ( :gets ) . and_return ( 'moose tracks' , '' )
56
56
expect ( shell . ask ( "What's your favorite Neopolitan flavor?" , :default => "vanilla" , :limited_to => [ "strawberry" , "chocolate" , "vanilla" ] ) ) . to eq ( "vanilla" )
57
57
end
0 commit comments