2015-09-25 12:07:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
describe Ci::Trigger, models: true do
|
|
|
|
let(:project) { FactoryGirl.create :empty_project }
|
2015-09-25 12:07:36 +05:30
|
|
|
|
|
|
|
describe 'before_validation' do
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'sets an random token if none provided' do
|
2015-09-25 12:07:36 +05:30
|
|
|
trigger = FactoryGirl.create :ci_trigger_without_token, project: project
|
|
|
|
expect(trigger.token).not_to be_nil
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'does not set an random token if one provided' do
|
2015-09-25 12:07:36 +05:30
|
|
|
trigger = FactoryGirl.create :ci_trigger, project: project
|
|
|
|
expect(trigger.token).to eq('token')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|