2015-11-13 13:22:46 -05:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: ci_triggers
|
|
|
|
#
|
2016-01-05 21:30:59 -05:00
|
|
|
# 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
|
2015-11-13 13:22:46 -05:00
|
|
|
#
|
|
|
|
|
2015-08-25 21:42:46 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-09 04:50:51 -05:00
|
|
|
describe Ci::Trigger, models: true do
|
2015-12-04 06:55:23 -05:00
|
|
|
let(:project) { FactoryGirl.create :empty_project }
|
2015-08-25 21:42:46 -04:00
|
|
|
|
|
|
|
describe 'before_validation' do
|
|
|
|
it 'should set an random token if none provided' do
|
2015-09-10 09:47:15 -04:00
|
|
|
trigger = FactoryGirl.create :ci_trigger_without_token, project: project
|
2015-09-10 09:52:52 -04:00
|
|
|
expect(trigger.token).not_to be_nil
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should not set an random token if one provided' do
|
2015-09-10 09:47:15 -04:00
|
|
|
trigger = FactoryGirl.create :ci_trigger, project: project
|
2015-09-10 09:52:52 -04:00
|
|
|
expect(trigger.token).to eq('token')
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|