gitlab-org--gitlab-foss/spec/models/ci/trigger_spec.rb

18 lines
504 B
Ruby
Raw Normal View History

2015-08-25 21:42:46 -04:00
require 'spec_helper'
2015-09-09 08:17:16 -04:00
describe Ci::Trigger do
2015-09-10 09:47:15 -04:00
let(:project) { FactoryGirl.create :ci_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