gitlab-org--gitlab-foss/spec/models/ci/trigger_spec.rb
Dmitriy Zaporozhets a237999f00
Annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-11-13 19:22:46 +01:00

29 lines
755 B
Ruby

# == Schema Information
#
# Table name: ci_triggers
#
# id :integer not null, primary key
# token :string(255)
# project_id :integer not null
# deleted_at :datetime
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
describe Ci::Trigger do
let(:project) { FactoryGirl.create :ci_project }
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