ruby/spec/rubyspec/library/syslog/shared/reopen.rb
eregon 95e8c48dd3 Add in-tree mspec and ruby/spec
* For easier modifications of ruby/spec by MRI developers.
* .gitignore: track changes under spec.
* spec/mspec, spec/rubyspec: add in-tree mspec and ruby/spec.
  These files can therefore be updated like any other file in MRI.
  Instructions are provided in spec/README.
  [Feature #13156] [ruby-core:79246]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-07 12:04:49 +00:00

40 lines
993 B
Ruby

describe :syslog_reopen, shared: true do
platform_is_not :windows do
before :each do
Syslog.opened?.should be_false
end
after :each do
Syslog.opened?.should be_false
end
it "reopens the log" do
Syslog.open
lambda { Syslog.send(@method)}.should_not raise_error
Syslog.opened?.should be_true
Syslog.close
end
it "fails with RuntimeError if the log is closed" do
lambda { Syslog.send(@method)}.should raise_error(RuntimeError)
end
it "receives the same parameters as Syslog.open" do
Syslog.open
Syslog.send(@method, "rubyspec", 3, 8) do |s|
s.should == Syslog
s.ident.should == "rubyspec"
s.options.should == 3
s.facility.should == Syslog::LOG_USER
s.opened?.should be_true
end
Syslog.opened?.should be_false
end
it "returns the module" do
Syslog.open
Syslog.send(@method).should == Syslog
Syslog.close
end
end
end