summaryrefslogtreecommitdiff
path: root/spec/models/build_spec.rb
blob: 71d2be542a3a6714c2ac04da43b0266c1132d848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'spec_helper'

describe Build do
  subject { Build.new }

  it { should belong_to(:project) }
  it { should validate_presence_of :sha }
  it { should validate_presence_of :ref }
  it { should validate_presence_of :status }

  it { should respond_to :success? }
  it { should respond_to :failed? }
  it { should respond_to :running? }
  it { should respond_to :pending? }
  it { should respond_to :git_author_name }
  it { should respond_to :short_sha }
  it { should respond_to :trace_html }

  describe "#ci_skip?" do
    let(:project) { FactoryGirl.create(:project) }
    let(:build) { project.register_build(ref: 'master') }
    it 'true if commit message contains [ci skip]' do
      build.commit.stub(:message) { 'Small typo [ci skip]' }
      build.ci_skip?.should == true
    end
    it 'false if commit message does not contain [ci skip]' do
      build.ci_skip?.should == false
    end
  end
end



# == Schema Information
#
# Table name: builds
#
#  id          :integer(4)      not null, primary key
#  project_id  :integer(4)
#  ref         :string(255)
#  status      :string(255)
#  finished_at :datetime
#  trace       :text(2147483647
#  created_at  :datetime        not null
#  updated_at  :datetime        not null
#  sha         :string(255)
#  started_at  :datetime
#  tmp_file    :string(255)
#  before_sha  :string(255)
#