require 'spec_helper' describe IcecastServer do let(:server) { IcecastServer.new } let(:output) { StringIO.new } let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) } it "save" do server = FactoryGirl.create(:icecast_server_minimal) server.save! server.reload server.dumpXml(builder) output.rewind xml = Nokogiri::XML(output) xml.css('icecast hostname').text.should == server.hostname xml.css('icecast location').text.should == server.location xml.css('icecast admin').text.should == server.admin_email xml.css('icecast fileserve').text.should == (server.fileserve ? '1' : '0') xml.css('icecast server-id').text.should == server.server_id xml.css('icecast limits').length.should == 1 xml.css('icecast authentication').length.should == 1 xml.css('icecast directory').length.should == 0 xml.css('icecast master-server').length.should == 0 xml.css('icecast paths').length.should == 1 xml.css('icecast logging').length.should == 1 xml.css('icecast security').length.should == 1 xml.css('icecast listen-socket').length.should == 1 end end