Sha256: 595d5e844c3a88f01923630cb69040d7f44c04d6bed0c9ee40a89d3b48e8a2bf

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Status::Jenkins do

  subject {Status::Jenkins.new("")}

  before do
    Status.stub(:config => stub(:attrs => {}))

    stub(Status::Request)
  end

  context "#state" do
    it "has a path with underscores" do
      Status::Jenkins.new("dr/feature").path.should == "/job/dr_feature/lastBuild/api/json"
    end

    it "is success when ci result is success" do
      Status::Request.stub(:new => stub(:get => {"building" => false, "result" => "success"}))
      subject.state.should == "success"
    end

    it "is Building when ci result is building" do
      Status::Request.stub(:new => stub(:get => {"building" => true, "result" => "success"}))
      subject.state.should == "pending"
    end

    it "is Building when ci result is in any other state" do
      Status::Request.stub(:new => stub(:get => {"building" => true, "result" => "failed"}))
      subject.state.should == "pending"
    end

    it "is Building when ci result is not found" do
      Status::Request.stub(:new => stub(:get => "not found"))
      subject.state.should == "pending"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
update_status-0.2.2 spec/status/jenkins_spec.rb
update_status-0.2.1 spec/status/jenkins_spec.rb