1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move spec/rubyspec to spec/ruby for consistency

* Other ruby implementations use the spec/ruby directory.
  [Misc #13792] [ruby-core:82287]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-09-20 20:18:52 +00:00
parent 75bfc6440d
commit 1d15d5f080
4370 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,40 @@
describe :syslog_log, shared: true do
platform_is_not :windows, :darwin, :solaris, :aix do
before :each do
Syslog.opened?.should be_false
end
after :each do
Syslog.opened?.should be_false
end
it "logs a message" do
lambda {
Syslog.open("rubyspec", Syslog::LOG_PERROR) do
Syslog.send(@method, "Hello")
end
}.should output_to_fd("rubyspec: Hello\n", $stderr)
end
it "accepts sprintf arguments" do
lambda {
Syslog.open("rubyspec", Syslog::LOG_PERROR) 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)
end
it "works as an alias for Syslog.log" do
level = Syslog.const_get "LOG_#{@method.to_s.upcase}"
response = "rubyspec: Hello\n"
lambda {
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)
end
end
end

View file

@ -0,0 +1,40 @@
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