61 lines
1.5 KiB
Ruby
61 lines
1.5 KiB
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 = 1
|
|
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
|
|
|
|
describe "poke configs" do
|
|
let(:server) { a = FactoryBot.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) }
|
|
|
|
it "success via template" do
|
|
server.template.security.save!
|
|
server.reload
|
|
server.config_changed.should == 1
|
|
end
|
|
|
|
it "delete via template" do
|
|
server.template.security.destroy
|
|
server.reload
|
|
server.config_changed.should == 1
|
|
end
|
|
|
|
it "success via server" do
|
|
server.security.save!
|
|
server.reload
|
|
server.config_changed.should == 1
|
|
end
|
|
|
|
it "delete via server" do
|
|
server.security.destroy
|
|
server.reload
|
|
server.config_changed.should == 1
|
|
end
|
|
end
|
|
end |