features/step_definitions/hudson_steps.rb in hudson-0.3.1 vs features/step_definitions/hudson_steps.rb in hudson-0.5.0

- old
+ new

@@ -3,12 +3,11 @@ port = 3010 begin res = Net::HTTP.start("localhost", port) { |http| http.get('/api/json') } Hudson::Api.base_uri "http://localhost:#{port}" rescue Errno::ECONNREFUSED => e - puts "\n\n\nERROR: To run tests, launch hudson in test mode: 'rake hudson:server:test'\n\n\n" - exit + raise Exception, "To run tests, launch hudson in test mode: 'rake hudson:server:test'" end @hudson_port = port.to_s @hudson_host = 'localhost' end end @@ -87,7 +86,19 @@ When the project uses "git" scm When I run local executable "hudson" with arguments "create . --host localhost --port 3010#{override}" CUCUMBER end +Then /^the job "([^"]*)" config "([^"]*)" should be:$/ do |job_name, xpath, string| + raise "Cannot yet fetch XML config from non-localhost Hudson" unless Hudson::Api.base_uri =~ /localhost/ + require "hpricot" + config = Hpricot.XML(File.read("#{test_hudson_path}/jobs/#{job_name}/config.xml")) + config.search(xpath).to_s.should == string +end +Then /^the Hudson config "([^"]*)" should be:$/ do |xpath, string| + raise "Cannot yet fetch XML config from non-localhost Hudson" unless Hudson::Api.base_uri =~ /localhost/ + require "hpricot" + config = Hpricot.XML(File.read("#{test_hudson_path}/config.xml")) + config.search(xpath).to_s.should == string +end