BigW Consortium Gitlab

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

13 14
require 'spec_helper'

15
describe Ci::Trigger do
16
  let(:project) { FactoryGirl.create :ci_project }
17 18 19

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

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