projects.rb 1.81 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# == Schema Information
#
# Table name: projects
#
#  id                       :integer          not null, primary key
#  name                     :string(255)      not null
#  timeout                  :integer          default(3600), not null
#  created_at               :datetime
#  updated_at               :datetime
#  token                    :string(255)
#  default_ref              :string(255)
#  path                     :string(255)
#  always_build             :boolean          default(FALSE), not null
#  polling_interval         :integer
#  public                   :boolean          default(FALSE), not null
#  ssh_url_to_repo          :string(255)
#  gitlab_id                :integer
#  allow_git_fetch          :boolean          default(TRUE), not null
#  email_recipients         :string(255)      default(""), not null
#  email_add_pusher         :boolean          default(TRUE), not null
#  email_only_broken_builds :boolean          default(TRUE), not null
#  skip_refs                :string(255)
#  coverage_regex           :string(255)
#  shared_runners_enabled   :boolean          default(FALSE)
#  generated_yaml_config    :text
#

# Read about factories at https://github.com/thoughtbot/factory_girl

FactoryGirl.define do
31
  factory :ci_project_without_token, class: Ci::Project do
32 33
    default_ref 'master'

Kamil Trzcinski's avatar
Kamil Trzcinski committed
34 35
    shared_runners_enabled false

36
    factory :ci_project do
37 38 39
      token 'iPWx6WM4lhHNedGfBpPJNP'
    end

40 41 42 43 44 45 46 47
    initialize_with do
      # TODO:
      # this is required, because builds_enabled is initialized when Project is created
      # and this create gitlab_ci_project if builds is set to true
      # here we take created gitlab_ci_project and update it's attributes
      ci_project = create(:empty_project).ensure_gitlab_ci_project
      ci_project.update_attributes(attributes)
      ci_project
48 49 50
    end
  end
end