diff options
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/ci/pipelines.rb | 8 | ||||
-rw-r--r-- | spec/factories/ci/runners.rb | 8 | ||||
-rw-r--r-- | spec/factories/ci/stages.rb | 3 | ||||
-rw-r--r-- | spec/factories/groups.rb | 3 | ||||
-rw-r--r-- | spec/factories/notes.rb | 6 | ||||
-rw-r--r-- | spec/factories/projects.rb | 8 | ||||
-rw-r--r-- | spec/factories/timelogs.rb | 9 | ||||
-rw-r--r-- | spec/factories/todos.rb | 4 |
8 files changed, 47 insertions, 2 deletions
diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 1735791f644..77404f46c92 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -31,6 +31,14 @@ FactoryGirl.define do File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml')) end end + + # Populates pipeline with errors + # + pipeline.config_processor if evaluator.config + end + + trait :invalid do + config(rspec: nil) end end end diff --git a/spec/factories/ci/runners.rb b/spec/factories/ci/runners.rb index e3b73e29987..c3b4aff55ba 100644 --- a/spec/factories/ci/runners.rb +++ b/spec/factories/ci/runners.rb @@ -8,10 +8,18 @@ FactoryGirl.define do is_shared false active true + trait :online do + contacted_at Time.now + end + trait :shared do is_shared true end + trait :specific do + is_shared false + end + trait :inactive do active false end diff --git a/spec/factories/ci/stages.rb b/spec/factories/ci/stages.rb index ee3b17b8bf1..7f557b25ccb 100644 --- a/spec/factories/ci/stages.rb +++ b/spec/factories/ci/stages.rb @@ -3,11 +3,12 @@ FactoryGirl.define do transient do name 'test' status nil + warnings nil pipeline factory: :ci_empty_pipeline end initialize_with do - Ci::Stage.new(pipeline, name: name, status: status) + Ci::Stage.new(pipeline, name: name, status: status, warnings: warnings) end end end diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index ece6beb9fa9..86f51ffca99 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -1,8 +1,9 @@ FactoryGirl.define do - factory :group do + factory :group, class: Group, parent: :namespace do sequence(:name) { |n| "group#{n}" } path { name.downcase.gsub(/\s/, '_') } type 'Group' + owner nil trait :public do visibility_level Gitlab::VisibilityLevel::PUBLIC diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index a10ba629760..476f2a37793 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -13,6 +13,7 @@ FactoryGirl.define do factory :note_on_issue, traits: [:on_issue], aliases: [:votable_note] factory :note_on_merge_request, traits: [:on_merge_request] factory :note_on_project_snippet, traits: [:on_project_snippet] + factory :note_on_personal_snippet, traits: [:on_personal_snippet] factory :system_note, traits: [:system] factory :legacy_diff_note_on_commit, traits: [:on_commit, :legacy_diff_note], class: LegacyDiffNote @@ -70,6 +71,11 @@ FactoryGirl.define do noteable { create(:project_snippet, project: project) } end + trait :on_personal_snippet do + noteable { create(:personal_snippet) } + project nil + end + trait :system do system true end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index b236a94062f..715b2a27b30 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -24,10 +24,18 @@ FactoryGirl.define do visibility_level Gitlab::VisibilityLevel::PRIVATE end + trait :archived do + archived true + end + trait :access_requestable do request_access_enabled true end + trait :repository do + # no-op... for now! + end + trait :empty_repo do after(:create) do |project| project.create_repository diff --git a/spec/factories/timelogs.rb b/spec/factories/timelogs.rb new file mode 100644 index 00000000000..12fc4ec4486 --- /dev/null +++ b/spec/factories/timelogs.rb @@ -0,0 +1,9 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :timelog do + time_spent 3600 + user + association :trackable, factory: :issue + end +end diff --git a/spec/factories/todos.rb b/spec/factories/todos.rb index 082b02116c0..85a8c263643 100644 --- a/spec/factories/todos.rb +++ b/spec/factories/todos.rb @@ -28,6 +28,10 @@ FactoryGirl.define do action { Todo::APPROVAL_REQUIRED } end + trait :unmergeable do + action { Todo::UNMERGEABLE } + end + trait :done do state :done end |