Commit 3c2a6be0 authored by Semyon Pupkov's avatar Semyon Pupkov

Fix warning: already initialized constant STATUSES

spec/lib/gitlab/background_migration/migrate_stage_status_spec.rb:9: warning: already initialized constant STATUSES
spec/lib/gitlab/background_migration/migrate_build_stage_spec.rb:9: warning: previous definition of STATUSES was here
parent f9550541
...@@ -6,8 +6,18 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201 ...@@ -6,8 +6,18 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201
let(:stages) { table(:ci_stages) } let(:stages) { table(:ci_stages) }
let(:jobs) { table(:ci_builds) } let(:jobs) { table(:ci_builds) }
STATUSES = { created: 0, pending: 1, running: 2, success: 3, let(:statuses) do
failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze {
created: 0,
pending: 1,
running: 2,
success: 3,
failed: 4,
canceled: 5,
skipped: 6,
manual: 7
}
end
before do before do
projects.create!(id: 123, name: 'gitlab', path: 'gitlab-ce') projects.create!(id: 123, name: 'gitlab', path: 'gitlab-ce')
...@@ -36,9 +46,9 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201 ...@@ -36,9 +46,9 @@ describe Gitlab::BackgroundMigration::MigrateBuildStage, :migration, schema: 201
expect(stages.all.pluck(:name)).to match_array %w[test build deploy] expect(stages.all.pluck(:name)).to match_array %w[test build deploy]
expect(jobs.where(stage_id: nil)).to be_one expect(jobs.where(stage_id: nil)).to be_one
expect(jobs.find_by(stage_id: nil).id).to eq 6 expect(jobs.find_by(stage_id: nil).id).to eq 6
expect(stages.all.pluck(:status)).to match_array [STATUSES[:success], expect(stages.all.pluck(:status)).to match_array [statuses[:success],
STATUSES[:failed], statuses[:failed],
STATUSES[:pending]] statuses[:pending]]
end end
it 'recovers from unique constraint violation only twice' do it 'recovers from unique constraint violation only twice' do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20170711145320 do describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20170711145320 do
...@@ -6,8 +8,18 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20 ...@@ -6,8 +8,18 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
let(:stages) { table(:ci_stages) } let(:stages) { table(:ci_stages) }
let(:jobs) { table(:ci_builds) } let(:jobs) { table(:ci_builds) }
STATUSES = { created: 0, pending: 1, running: 2, success: 3, let(:statuses) do
failed: 4, canceled: 5, skipped: 6, manual: 7 }.freeze {
created: 0,
pending: 1,
running: 2,
success: 3,
failed: 4,
canceled: 5,
skipped: 6,
manual: 7
}
end
before do before do
projects.create!(id: 1, name: 'gitlab1', path: 'gitlab1') projects.create!(id: 1, name: 'gitlab1', path: 'gitlab1')
...@@ -26,8 +38,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20 ...@@ -26,8 +38,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it 'sets a correct stage status' do it 'sets a correct stage status' do
described_class.new.perform(1, 2) described_class.new.perform(1, 2)
expect(stages.first.status).to eq STATUSES[:running] expect(stages.first.status).to eq statuses[:running]
expect(stages.second.status).to eq STATUSES[:failed] expect(stages.second.status).to eq statuses[:failed]
end end
end end
...@@ -35,8 +47,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20 ...@@ -35,8 +47,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it 'sets a skipped stage status' do it 'sets a skipped stage status' do
described_class.new.perform(1, 2) described_class.new.perform(1, 2)
expect(stages.first.status).to eq STATUSES[:skipped] expect(stages.first.status).to eq statuses[:skipped]
expect(stages.second.status).to eq STATUSES[:skipped] expect(stages.second.status).to eq statuses[:skipped]
end end
end end
...@@ -50,8 +62,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20 ...@@ -50,8 +62,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it 'sets a correct stage status' do it 'sets a correct stage status' do
described_class.new.perform(1, 2) described_class.new.perform(1, 2)
expect(stages.first.status).to eq STATUSES[:canceled] expect(stages.first.status).to eq statuses[:canceled]
expect(stages.second.status).to eq STATUSES[:success] expect(stages.second.status).to eq statuses[:success]
end end
end end
...@@ -65,8 +77,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20 ...@@ -65,8 +77,8 @@ describe Gitlab::BackgroundMigration::MigrateStageStatus, :migration, schema: 20
it 'sets a correct stage status' do it 'sets a correct stage status' do
described_class.new.perform(1, 2) described_class.new.perform(1, 2)
expect(stages.first.status).to eq STATUSES[:manual] expect(stages.first.status).to eq statuses[:manual]
expect(stages.second.status).to eq STATUSES[:success] expect(stages.second.status).to eq statuses[:success]
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment