require 'spec_helper' require 'capistrano/recipes/deploy/scm/jenkins' module Capistrano::Deploy::SCM describe Jenkins do before :each do @jenkins = Jenkins.new end context "last_deploy_build" do it "should support back to normal" do msg = %Q{ estore-nginx all builds2011-11-24T07:11:06ZJenkins Serverurn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66estore-nginx #2 (back to normal)tag:hudson.dev.java.net,2011:estore-nginx:2011-11-24_15-11-062011-11-24T07:11:06Z2011-11-24T07:11:06Zestore-nginx #1 (broken for a long time)tag:hudson.dev.java.net,2011:estore-nginx:2011-11-24_15-09-182011-11-24T07:09:18Z2011-11-24T07:09:18Z} @jenkins.send(:last_deploy_build, msg).should == '2' end it "should support stable" do msg = %Q{ cerl all builds2011-11-17T05:17:58ZJenkins Serverurn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66cerl #98 (stable)tag:hudson.dev.java.net,2011:cerl:2011-11-17_13-17-582011-11-17T05:17:58Z2011-11-17T05:17:58Zcerl #97 (stable)tag:hudson.dev.java.net,2011:cerl:2011-11-12_18-27-582011-11-12T10:27:58Z2011-11-12T10:27:58Z} @jenkins.send(:last_deploy_build, msg).should == '98' end it "should honor unstable" do msg = %Q{ IndexCoordinator all builds2011-11-24T09:22:32ZJenkins Serverurn:uuid:903deee0-7bfa-11db-9fe1-0800200c9a66IndexCoordinator #1450 (unstable)tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-44-232011-11-22T11:44:23Z2011-11-22T11:44:23ZIndexCoordinator #1449 (back to normal)tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-23-222011-11-22T11:23:22Z2011-11-22T11:23:22ZIndexCoordinator #1448 (broken since this build)tag:hudson.dev.java.net,2011:IndexCoordinator:2011-11-22_19-10-502011-11-22T11:10:50Z2011-11-22T11:10:50Z } @jenkins.send(:last_deploy_build, msg).should == '1449' @jenkins.send(:last_deploy_build, msg, :use_unstable => true).should == '1450' end end end end