BigW Consortium Gitlab

trigger_spec.rb 798 Bytes
Newer Older
Dmitriy Zaporozhets committed
1 2 3 4
# == Schema Information
#
# Table name: ci_triggers
#
Stan Hu committed
5 6 7 8 9 10 11
#  id            :integer          not null, primary key
#  token         :string(255)
#  project_id    :integer
#  deleted_at    :datetime
#  created_at    :datetime
#  updated_at    :datetime
#  gl_project_id :integer
Dmitriy Zaporozhets committed
12 13
#

14 15
require 'spec_helper'

Douwe Maan committed
16
describe Ci::Trigger, models: true do
17
  let(:project) { FactoryGirl.create :empty_project }
18 19 20

  describe 'before_validation' do
    it 'should set an random token if none provided' do
21
      trigger = FactoryGirl.create :ci_trigger_without_token, project: project
Dmitriy Zaporozhets committed
22
      expect(trigger.token).not_to be_nil
23 24 25
    end

    it 'should not set an random token if one provided' do
26
      trigger = FactoryGirl.create :ci_trigger, project: project
Dmitriy Zaporozhets committed
27
      expect(trigger.token).to eq('token')
28 29 30
    end
  end
end