1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-01-28 20:47:48 +01:00
parent ed377cc9aa
commit 809f0b8a13
76 changed files with 2451 additions and 224 deletions

View file

@ -1,7 +1,6 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
require_relative 'shared/sprintf'
require "stringio"
describe "Kernel#printf" do
it "is a private method" do
@ -32,8 +31,14 @@ describe "Kernel.printf" do
object.should_receive(:write).with("string")
Kernel.printf(object, "%s", "string")
end
end
describe "Kernel.printf" do
describe "formatting" do
before :each do
require "stringio"
end
context "io is specified" do
it_behaves_like :kernel_sprintf, -> format, *args {
io = StringIO.new
@ -45,7 +50,6 @@ describe "Kernel.printf" do
context "io is not specified" do
it_behaves_like :kernel_sprintf, -> format, *args {
stdout = $stdout
begin
$stdout = io = StringIO.new
Kernel.printf(format, *args)