debian-mirror-gitlab/spec/models/ci/trigger_spec.rb

31 lines
798 B
Ruby
Raw Normal View History

2015-11-26 14:37:03 +05:30
# == Schema Information
#
# Table name: ci_triggers
#
# 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-26 14:37:03 +05:30
#
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
it 'should set an random token if none provided' do
trigger = FactoryGirl.create :ci_trigger_without_token, project: project
expect(trigger.token).not_to be_nil
end
it 'should not set an random token if one provided' do
trigger = FactoryGirl.create :ci_trigger, project: project
expect(trigger.token).to eq('token')
end
end
end