* suppressing puts to stdout in test runs

This commit is contained in:
Seth Call 2014-01-16 03:29:52 +00:00
parent 01e50b45b3
commit ece0b9bf87
7 changed files with 65 additions and 20 deletions

View File

@ -44,7 +44,7 @@ module JAmXml
end
end
unless ident <= 0
puts "#{tbse}</#{nm}>"
output.puts "#{tbse}</#{nm}>"
end
end

View File

@ -1,17 +1,31 @@
require 'spec_helper'
require 'stringio'
=begin
example output:
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
=end
describe IcecastDirectory do
let(:idir) { IcecastDirectory.new }
let(:output) { StringIO.new }
before(:all) do
before(:each) do
end
it "save" do
idir.save.should be_true
idir.dumpXml
idir.dumpXml(1, output)
output.rewind
directory = Nokogiri::XML(output)
directory.css('directory yp-url-timeout').text.should == "15"
directory.css('directory yp-url').text.should == "http://dir.xiph.org/cgi-bin/yp-cgi"
end
end

View File

@ -3,6 +3,7 @@ require 'spec_helper'
describe IcecastListenSocket do
let(:iobj) { IcecastListenSocket.new }
let(:output) { StringIO.new }
before(:all) do
@ -10,7 +11,12 @@ describe IcecastListenSocket do
it "save" do
iobj.save.should be_true
iobj.dumpXml
iobj.dumpXml(1, output)
output.rewind
directory = Nokogiri::XML(output)
directory.css('listen-socket port').text.should == "8001"
directory.css('listen-socket shoutcast-compat').text.should == "0"
end
end

View File

@ -3,14 +3,19 @@ require 'spec_helper'
describe IcecastLogging do
let(:iobj) { IcecastLogging.new }
before(:all) do
end
let(:output) { StringIO.new }
it "save" do
iobj.save.should be_true
iobj.dumpXml
iobj.dumpXml(1, output)
output.rewind
directory = Nokogiri::XML(output)
directory.css('logging accesslog').text.should == "access.log"
directory.css('logging errorlog').text.should == "error.log"
directory.css('logging loglevel').text.should == "4"
directory.css('logging playlistlog').text.should == "playlist.log"
end
end

View File

@ -3,14 +3,24 @@ require 'spec_helper'
describe IcecastPath do
let(:iobj) { IcecastPath.new }
before(:all) do
end
let(:output) { StringIO.new }
it "save" do
iobj.save.should be_true
iobj.dumpXml
iobj.dumpXml(1, output)
output.rewind
directory = Nokogiri::XML(output)
directory.css('paths basedir').text.should == "./"
directory.css('paths logdir').text.should == "./logs"
directory.css('paths pidfile').text.should == "./icecast.pid"
directory.css('paths webroot').text.should == "./web"
directory.css('paths adminroot').text.should == "./admin"
directory.css('paths allow-ip').text.should == "/path/to/ip_allowlist"
directory.css('paths deny-ip').text.should == "/path_to_ip_denylist"
directory.css('paths alias').text.should == ""
#puts directory.css('paths alias').first["source"]
end
end

View File

@ -3,17 +3,26 @@ require 'spec_helper'
describe IcecastSecurity do
let(:iobj) { IcecastSecurity.new }
let(:output) { StringIO.new }
before(:all) do
=begin
example output:
end
<security>
<chroot>0</chroot>
<changeowner>
<user>hotdog</user>
<group>mongrel</group>
<changeowner>
</security>
=end
it "save" do
iobj.changeowner_user ="hotdog"
iobj.changeowner_group ="mongrel"
iobj.save.should be_true
iobj.dumpXml
iobj.dumpXml(1, output)
end

View File

@ -3,6 +3,7 @@ require 'spec_helper'
describe IcecastUserAuthentication do
let(:iobj) { IcecastUserAuthentication.new }
let(:output) { StringIO.new }
before(:all) do
@ -11,7 +12,7 @@ describe IcecastUserAuthentication do
it "save" do
iobj.save
#puts iobj.inspect
iobj.dumpXml
iobj.dumpXml(1, output)
iobj.errors.any?.should be_false
end
@ -23,7 +24,7 @@ describe IcecastUserAuthentication do
#puts limit.inspect
iobj.filename ="/dfdfd</$%%%6566.auth"
iobj.save.should be_true
iobj.dumpXml
iobj.dumpXml(1, output)
end