spec/model/xml_spec.rb in puppetdb_rundeck-0.2.3 vs spec/model/xml_spec.rb in puppetdb_rundeck-0.3.0

- old
+ new

@@ -1,18 +1,21 @@ require File.expand_path '../../spec_helper.rb', __FILE__ require File.expand_path '../../../lib/helpers/puppetdb', __FILE__ -require File.expand_path '../../../lib/model/xml', __FILE__ -describe XMLOutput, '#parse' do +describe EndPoint, '#to_xml' do it 'should return valid xml containing the node name' do helper = Helpers::PuppetDB.new('fubar', '80') allow(helper).to receive(:get_nodes).and_return([{'name' => 'test.internal'}]) allow(helper).to receive(:get_facts).and_return([{'certname' => 'test.internal', 'name' => 'osfamily', 'value' => 'Debian'}]) - xml_output = XMLOutput.new(helper) + if File.exist?('/tmp/puppetdb-resource.xml') + FileUtils.rm '/tmp/puppetdb-resource.xml' + end - expectation = "<project>\n <node name=\"test.internal\" osfamily=\"Debian\" />\n </project>" + endpoint = EndPoint.new(helper) - xml_output.parse.should == expectation + expectation = "<project>\n <node name=\"test.internal\" osfamily=\"Debian\" />\n </project>" + + endpoint.to_xml().should == expectation end -end \ No newline at end of file +end