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
|
2016-08-01 11:00:44 -04:00
|
|
|
it 'sets 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
|
|
|
|
|
2016-08-01 11:00:44 -04:00
|
|
|
it 'does 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
|