spec/rr/double_spec.rb in rr-0.10.9 vs spec/rr/double_spec.rb in rr-0.10.10
- old
+ new
@@ -33,17 +33,23 @@
end
end
describe "#call" do
describe "when verbose" do
+ attr_reader :original_stdout
+ before do
+ @original_stdout = $stdout
+ end
+
+ after do
+ $stdout = original_stdout
+ end
+
it "prints the message call" do
double.definition.verbose
- output = nil
- (class << double; self; end).__send__(:define_method, :puts) do |output|
- output = output
- end
+ $stdout = StringIO.new(output = "")
subject.foobar(1, 2)
- output.should == Double.formatted_name(:foobar, [1, 2])
+ output.strip.should == Double.formatted_name(:foobar, [1, 2])
end
end
describe "when not verbose" do
it "does not print the message call" do
\ No newline at end of file