File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ def ask(statement, *args)
94
94
# say("I know you knew that.")
95
95
#
96
96
def say ( message = "" , color = nil , force_new_line = ( message . to_s !~ /( |\t )\Z / ) )
97
+ return if quiet?
98
+
97
99
buffer = prepare_message ( message , *color )
98
100
buffer << "\n " if force_new_line && !message . to_s . end_with? ( "\n " )
99
101
Original file line number Diff line number Diff line change @@ -173,6 +173,21 @@ def shell
173
173
expect ( $stdout) . to receive ( :print ) . with ( "this_is_not_a_string\n " )
174
174
shell . say ( :this_is_not_a_string , nil , true )
175
175
end
176
+
177
+ it "does not print a message if muted" do
178
+ expect ( $stdout) . not_to receive ( :print )
179
+ shell . mute do
180
+ shell . say ( "Running..." )
181
+ end
182
+ end
183
+
184
+ it "does not print a message if base is set to quiet" do
185
+ shell . base = MyCounter . new [ 1 , 2 ]
186
+ expect ( shell . base ) . to receive ( :options ) . and_return ( :quiet => true )
187
+
188
+ expect ( $stdout) . not_to receive ( :print )
189
+ shell . say ( "Running..." )
190
+ end
176
191
end
177
192
178
193
describe "#print_wrapped" do
You can’t perform that action at this time.
0 commit comments