summaryrefslogtreecommitdiff
path: root/spec/ruby/library/syslog/shared
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/syslog/shared')
-rw-r--r--spec/ruby/library/syslog/shared/log.rb13
-rw-r--r--spec/ruby/library/syslog/shared/reopen.rb14
2 files changed, 13 insertions, 14 deletions
diff --git a/spec/ruby/library/syslog/shared/log.rb b/spec/ruby/library/syslog/shared/log.rb
index b19c2eae0d..98ce4f54b2 100644
--- a/spec/ruby/library/syslog/shared/log.rb
+++ b/spec/ruby/library/syslog/shared/log.rb
@@ -1,11 +1,11 @@
describe :syslog_log, shared: true do
- platform_is_not :windows, :darwin, :solaris, :aix do
+ platform_is_not :windows, :darwin, :aix, :android do
before :each do
- Syslog.opened?.should be_false
+ Syslog.opened?.should == false
end
after :each do
- Syslog.opened?.should be_false
+ Syslog.opened?.should == false
end
it "logs a message" do
@@ -13,7 +13,7 @@ describe :syslog_log, shared: true do
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello")
end
- }.should output_to_fd("rubyspec: Hello\n", $stderr)
+ }.should output_to_fd(/\Arubyspec(?::| \d+ - -) Hello\n\z/, $stderr)
end
it "accepts sprintf arguments" do
@@ -22,19 +22,18 @@ describe :syslog_log, shared: true do
Syslog.send(@method, "Hello %s", "world")
Syslog.send(@method, "%d dogs", 2)
end
- }.should output_to_fd("rubyspec: Hello world\nrubyspec: 2 dogs\n", $stderr)
+ }.should output_to_fd(/\Arubyspec(?::| \d+ - -) Hello world\nrubyspec(?::| \d+ - -) 2 dogs\n\z/, $stderr)
end
it "works as an alias for Syslog.log" do
level = Syslog.const_get "LOG_#{@method.to_s.upcase}"
- response = "rubyspec: Hello\n"
-> {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello")
Syslog.log(level, "Hello")
end
# make sure the same thing is written to $stderr.
- }.should output_to_fd(response * 2, $stderr)
+ }.should output_to_fd(/\A(?:rubyspec(?::| \d+ - -) Hello\n){2}\z/, $stderr)
end
end
end
diff --git a/spec/ruby/library/syslog/shared/reopen.rb b/spec/ruby/library/syslog/shared/reopen.rb
index 621437a01d..f04408e807 100644
--- a/spec/ruby/library/syslog/shared/reopen.rb
+++ b/spec/ruby/library/syslog/shared/reopen.rb
@@ -1,22 +1,22 @@
describe :syslog_reopen, shared: true do
platform_is_not :windows do
before :each do
- Syslog.opened?.should be_false
+ Syslog.opened?.should == false
end
after :each do
- Syslog.opened?.should be_false
+ Syslog.opened?.should == false
end
it "reopens the log" do
Syslog.open
- -> { Syslog.send(@method)}.should_not raise_error
- Syslog.opened?.should be_true
+ -> { Syslog.send(@method)}.should_not.raise
+ Syslog.opened?.should == true
Syslog.close
end
it "fails with RuntimeError if the log is closed" do
- -> { Syslog.send(@method)}.should raise_error(RuntimeError)
+ -> { Syslog.send(@method)}.should.raise(RuntimeError)
end
it "receives the same parameters as Syslog.open" do
@@ -26,9 +26,9 @@ describe :syslog_reopen, shared: true do
s.ident.should == "rubyspec"
s.options.should == 3
s.facility.should == Syslog::LOG_USER
- s.opened?.should be_true
+ s.opened?.should == true
end
- Syslog.opened?.should be_false
+ Syslog.opened?.should == false
end
it "returns the module" do