33 lines
876 B
Ruby
33 lines
876 B
Ruby
require 'spec_helper'
|
|
|
|
describe IcecastSecurity do
|
|
|
|
let(:security) { IcecastSecurity.new }
|
|
let(:output) { StringIO.new }
|
|
let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) }
|
|
|
|
it "save with chroot" do
|
|
security.change_owner_user ="hotdog"
|
|
security.change_owner_group ="mongrel"
|
|
security.chroot = true
|
|
security.save!
|
|
security.dumpXml(builder)
|
|
|
|
output.rewind
|
|
xml = Nokogiri::XML(output)
|
|
xml.css('security chroot').text.should == '1'
|
|
xml.css('security changeowner user').text.should == 'hotdog'
|
|
xml.css('security changeowner group').text.should == 'mongrel'
|
|
end
|
|
|
|
it "save without chroot" do
|
|
security.save!
|
|
security.dumpXml(builder)
|
|
|
|
output.rewind
|
|
|
|
xml = Nokogiri::XML(output)
|
|
xml.css('security chroot').text.should == '0'
|
|
xml.css('security changeowner').length.should == 0
|
|
end
|
|
end |