summaryrefslogtreecommitdiff
path: root/spec/ruby/library/logger
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/logger')
-rw-r--r--spec/ruby/library/logger/device/close_spec.rb15
-rw-r--r--spec/ruby/library/logger/device/new_spec.rb8
-rw-r--r--spec/ruby/library/logger/device/write_spec.rb15
-rw-r--r--spec/ruby/library/logger/logger/add_spec.rb6
-rw-r--r--spec/ruby/library/logger/logger/datetime_format_spec.rb2
-rw-r--r--spec/ruby/library/logger/logger/new_spec.rb32
-rw-r--r--spec/ruby/library/logger/logger/unknown_spec.rb2
7 files changed, 31 insertions, 49 deletions
diff --git a/spec/ruby/library/logger/device/close_spec.rb b/spec/ruby/library/logger/device/close_spec.rb
index 7c5e118d56..1db5d582a7 100644
--- a/spec/ruby/library/logger/device/close_spec.rb
+++ b/spec/ruby/library/logger/device/close_spec.rb
@@ -15,17 +15,8 @@ describe "Logger::LogDevice#close" do
rm_r @file_path
end
- version_is Logger::VERSION, ""..."1.4.0" do
- it "closes the LogDevice's stream" do
- @device.close
- -> { @device.write("Test") }.should complain(/\Alog writing failed\./)
- end
- end
-
- version_is Logger::VERSION, "1.4.0" do
- it "closes the LogDevice's stream" do
- @device.close
- -> { @device.write("Test") }.should complain(/\Alog shifting failed\./)
- end
+ it "closes the LogDevice's stream" do
+ @device.close
+ -> { @device.write("Test") }.should complain(/\Alog shifting failed\./)
end
end
diff --git a/spec/ruby/library/logger/device/new_spec.rb b/spec/ruby/library/logger/device/new_spec.rb
index 26a38c2b8c..c943e7fbe2 100644
--- a/spec/ruby/library/logger/device/new_spec.rb
+++ b/spec/ruby/library/logger/device/new_spec.rb
@@ -14,11 +14,11 @@ describe "Logger::LogDevice#new" do
it "creates a new log device" do
l = Logger::LogDevice.new(@log_file)
- l.dev.should be_kind_of(File)
+ l.dev.should.is_a?(File)
end
it "receives an IO object to log there as first argument" do
- @log_file.should be_kind_of(IO)
+ @log_file.should.is_a?(IO)
l = Logger::LogDevice.new(@log_file)
l.write("foo")
@log_file.rewind
@@ -33,7 +33,7 @@ describe "Logger::LogDevice#new" do
File.should.exist?(path)
File.open(path) do |f|
- f.readlines.should_not be_empty
+ f.readlines.should_not.empty?
end
rm_r path
@@ -42,6 +42,6 @@ describe "Logger::LogDevice#new" do
it "receives options via a hash as second argument" do
-> {
Logger::LogDevice.new(STDERR, shift_age: 8, shift_size: 10)
- }.should_not raise_error
+ }.should_not.raise
end
end
diff --git a/spec/ruby/library/logger/device/write_spec.rb b/spec/ruby/library/logger/device/write_spec.rb
index cd2d7e27a9..87ecf2ad6a 100644
--- a/spec/ruby/library/logger/device/write_spec.rb
+++ b/spec/ruby/library/logger/device/write_spec.rb
@@ -35,17 +35,8 @@ describe "Logger::LogDevice#write" do
rm_r path
end
- version_is Logger::VERSION, ""..."1.4.0" do
- it "fails if the device is already closed" do
- @device.close
- -> { @device.write "foo" }.should complain(/\Alog writing failed\./)
- end
- end
-
- version_is Logger::VERSION, "1.4.0" do
- it "fails if the device is already closed" do
- @device.close
- -> { @device.write "foo" }.should complain(/\Alog shifting failed\./)
- end
+ it "fails if the device is already closed" do
+ @device.close
+ -> { @device.write "foo" }.should complain(/\Alog shifting failed\./)
end
end
diff --git a/spec/ruby/library/logger/logger/add_spec.rb b/spec/ruby/library/logger/logger/add_spec.rb
index 3f709e18ba..98ac88f64f 100644
--- a/spec/ruby/library/logger/logger/add_spec.rb
+++ b/spec/ruby/library/logger/logger/add_spec.rb
@@ -56,7 +56,7 @@ describe "Logger#add" do
@logger.log(nil, "test", "TestApp") do
1+1
end
- }.should_not raise_error
+ }.should_not.raise
end
it "calls the block if message is nil" do
@@ -65,7 +65,7 @@ describe "Logger#add" do
@logger.log(nil, nil, "TestApp") do
temp = 1+1
end
- }.should_not raise_error
+ }.should_not.raise
temp.should == 2
end
@@ -75,7 +75,7 @@ describe "Logger#add" do
@logger.log(nil, "not nil", "TestApp") do
temp = 1+1
end
- }.should_not raise_error
+ }.should_not.raise
temp.should == 0
end
end
diff --git a/spec/ruby/library/logger/logger/datetime_format_spec.rb b/spec/ruby/library/logger/logger/datetime_format_spec.rb
index 582b34bfda..75a7f6cc03 100644
--- a/spec/ruby/library/logger/logger/datetime_format_spec.rb
+++ b/spec/ruby/library/logger/logger/datetime_format_spec.rb
@@ -49,7 +49,7 @@ describe "Logger#datetime_format=" do
end
it "follows the Time#strftime format" do
- -> { @logger.datetime_format = "%Y-%m" }.should_not raise_error
+ -> { @logger.datetime_format = "%Y-%m" }.should_not.raise
regex = /\d{4}-\d{2}-\d{2}oo-\w+ar/
@logger.datetime_format = "%Foo-%Bar"
diff --git a/spec/ruby/library/logger/logger/new_spec.rb b/spec/ruby/library/logger/logger/new_spec.rb
index d3100ee2d1..b311c96132 100644
--- a/spec/ruby/library/logger/logger/new_spec.rb
+++ b/spec/ruby/library/logger/logger/new_spec.rb
@@ -13,28 +13,28 @@ describe "Logger#new" do
rm_r @file_path
end
- it "creates a new logger object" do
- l = Logger.new(STDERR)
- -> { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
- end
+ it "creates a new logger object" do
+ l = Logger.new(STDERR)
+ -> { l.add(Logger::WARN, "Foo") }.should output_to_fd(/Foo/, STDERR)
+ end
- it "receives a logging device as first argument" do
- l = Logger.new(@log_file)
- l.add(Logger::WARN, "Test message")
+ it "receives a logging device as first argument" do
+ l = Logger.new(@log_file)
+ l.add(Logger::WARN, "Test message")
- @log_file.rewind
- LoggerSpecs.strip_date(@log_file.readline).should == "WARN -- : Test message\n"
- l.close
- end
+ @log_file.rewind
+ LoggerSpecs.strip_date(@log_file.readline).should == "WARN -- : Test message\n"
+ l.close
+ end
it "receives a frequency rotation as second argument" do
- -> { 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
+ -> { Logger.new(@log_file, "daily") }.should_not.raise
+ -> { Logger.new(@log_file, "weekly") }.should_not.raise
+ -> { Logger.new(@log_file, "monthly") }.should_not.raise
end
it "also receives a number of log files to keep as second argument" do
- -> { Logger.new(@log_file, 1).close }.should_not raise_error
+ -> { Logger.new(@log_file, 1).close }.should_not.raise
end
it "receives a maximum logfile size as third argument" do
@@ -94,7 +94,7 @@ describe "Logger#new" do
logger.formatter.should == formatter
end
- it "receives shift_period_suffix " do
+ it "receives shift_period_suffix" do
shift_period_suffix = "%Y-%m-%d"
path = tmp("shift_period_suffix_test.log")
now = Time.now
diff --git a/spec/ruby/library/logger/logger/unknown_spec.rb b/spec/ruby/library/logger/logger/unknown_spec.rb
index b174b8b2c9..4d37c9797e 100644
--- a/spec/ruby/library/logger/logger/unknown_spec.rb
+++ b/spec/ruby/library/logger/logger/unknown_spec.rb
@@ -29,7 +29,7 @@ describe "Logger#unknown" do
end
it "receives empty messages" do
- -> { @logger.unknown("") }.should_not raise_error
+ -> { @logger.unknown("") }.should_not.raise
@log_file.rewind
LoggerSpecs.strip_date(@log_file.readlines.first).should == "ANY -- : \n"
end