mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@875a09e
This commit is contained in:
parent
a06301b103
commit
5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions
|
@ -18,14 +18,14 @@ describe "Logger::LogDevice#close" do
|
|||
ruby_version_is ""..."2.7" do
|
||||
it "closes the LogDevice's stream" do
|
||||
@device.close
|
||||
lambda { @device.write("Test") }.should complain(/\Alog writing failed\./)
|
||||
-> { @device.write("Test") }.should complain(/\Alog writing failed\./)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.7" do
|
||||
it "closes the LogDevice's stream" do
|
||||
@device.close
|
||||
lambda { @device.write("Test") }.should complain(/\Alog shifting failed\./)
|
||||
-> { @device.write("Test") }.should complain(/\Alog shifting failed\./)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ describe "Logger::LogDevice#new" do
|
|||
end
|
||||
|
||||
it "receives options via a hash as second argument" do
|
||||
lambda { Logger::LogDevice.new(STDERR,
|
||||
-> { Logger::LogDevice.new(STDERR,
|
||||
{ shift_age: 8, shift_size: 10
|
||||
})}.should_not raise_error
|
||||
end
|
||||
|
|
|
@ -38,14 +38,14 @@ describe "Logger::LogDevice#write" do
|
|||
ruby_version_is ""..."2.7" do
|
||||
it "fails if the device is already closed" do
|
||||
@device.close
|
||||
lambda { @device.write "foo" }.should complain(/\Alog writing failed\./)
|
||||
-> { @device.write "foo" }.should complain(/\Alog writing failed\./)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.7" do
|
||||
it "fails if the device is already closed" do
|
||||
@device.close
|
||||
lambda { @device.write "foo" }.should complain(/\Alog shifting failed\./)
|
||||
-> { @device.write "foo" }.should complain(/\Alog shifting failed\./)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ describe "Logger#add" do
|
|||
end
|
||||
|
||||
it "receives a block" do
|
||||
lambda {
|
||||
-> {
|
||||
@logger.log(nil, "test", "TestApp") do
|
||||
1+1
|
||||
end
|
||||
|
@ -61,7 +61,7 @@ describe "Logger#add" do
|
|||
|
||||
it "calls the block if message is nil" do
|
||||
temp = 0
|
||||
lambda {
|
||||
-> {
|
||||
@logger.log(nil, nil, "TestApp") do
|
||||
temp = 1+1
|
||||
end
|
||||
|
@ -71,7 +71,7 @@ describe "Logger#add" do
|
|||
|
||||
it "ignores the block if the message is not nil" do
|
||||
temp = 0
|
||||
lambda {
|
||||
-> {
|
||||
@logger.log(nil, "not nil", "TestApp") do
|
||||
temp = 1+1
|
||||
end
|
||||
|
|
|
@ -15,6 +15,6 @@ describe "Logger#close" do
|
|||
|
||||
it "closes the logging device" do
|
||||
@logger.close
|
||||
lambda { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./)
|
||||
-> { @logger.add(nil, "Foo") }.should complain(/\Alog writing failed\./)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ describe "Logger#datetime_format=" do
|
|||
end
|
||||
|
||||
it "follows the Time#strftime format" do
|
||||
lambda { @logger.datetime_format = "%Y-%m" }.should_not raise_error
|
||||
-> { @logger.datetime_format = "%Y-%m" }.should_not raise_error
|
||||
|
||||
regex = /\d{4}-\d{2}-\d{2}oo-\w+ar/
|
||||
@logger.datetime_format = "%Foo-%Bar"
|
||||
|
|
|
@ -15,7 +15,7 @@ describe "Logger#new" do
|
|||
|
||||
it "creates a new logger object" do
|
||||
l = Logger.new(STDERR)
|
||||
lambda { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
|
||||
-> { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
|
||||
end
|
||||
|
||||
it "receives a logging device as first argument" do
|
||||
|
@ -28,13 +28,13 @@ describe "Logger#new" do
|
|||
end
|
||||
|
||||
it "receives a frequency rotation as second argument" do
|
||||
lambda { Logger.new(@log_file, "daily") }.should_not raise_error
|
||||
lambda { Logger.new(@log_file, "weekly") }.should_not raise_error
|
||||
lambda { Logger.new(@log_file, "monthly") }.should_not raise_error
|
||||
-> { Logger.new(@log_file, "daily") }.should_not raise_error
|
||||
-> { Logger.new(@log_file, "weekly") }.should_not raise_error
|
||||
-> { Logger.new(@log_file, "monthly") }.should_not raise_error
|
||||
end
|
||||
|
||||
it "also receives a number of log files to keep as second argument" do
|
||||
lambda { Logger.new(@log_file, 1).close }.should_not raise_error
|
||||
-> { Logger.new(@log_file, 1).close }.should_not raise_error
|
||||
end
|
||||
|
||||
it "receives a maximum logfile size as third argument" do
|
||||
|
|
|
@ -29,7 +29,7 @@ describe "Logger#unknown" do
|
|||
end
|
||||
|
||||
it "receives empty messages" do
|
||||
lambda { @logger.unknown("") }.should_not raise_error
|
||||
-> { @logger.unknown("") }.should_not raise_error
|
||||
@log_file.rewind
|
||||
LoggerSpecs.strip_date(@log_file.readlines.first).should == "ANY -- : \n"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue