Removes db/fixtures from database files

This will avoid Danger to suggest a database review for files inside
db/fixtures
This commit is contained in:
Mayra Cabrera 2019-08-15 17:42:13 +00:00 committed by Stan Hu
parent 1985bafe2b
commit 157b047e9d
2 changed files with 13 additions and 5 deletions

View file

@ -113,7 +113,7 @@ module Gitlab
yarn\.lock
)\z}x => :frontend,
%r{\A(ee/)?db/} => :database,
%r{\A(ee/)?db/(?!fixtures)[^/]+} => :database,
%r{\A(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|\.rb)} => :database,
%r{\A(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|\.rb)} => :database,
%r{\Arubocop/cop/migration(/|\.rb)} => :database,

View file

@ -101,13 +101,13 @@ describe Gitlab::Danger::Helper do
describe '#changes_by_category' do
it 'categorizes changed files' do
expect(fake_git).to receive(:added_files) { %w[foo foo.md foo.rb foo.js db/foo lib/gitlab/database/foo.rb qa/foo ee/changelogs/foo.yml] }
expect(fake_git).to receive(:added_files) { %w[foo foo.md foo.rb foo.js db/migrate/foo lib/gitlab/database/foo.rb qa/foo ee/changelogs/foo.yml] }
allow(fake_git).to receive(:modified_files) { [] }
allow(fake_git).to receive(:renamed_files) { [] }
expect(helper.changes_by_category).to eq(
backend: %w[foo.rb],
database: %w[db/foo lib/gitlab/database/foo.rb],
database: %w[db/migrate/foo lib/gitlab/database/foo.rb],
frontend: %w[foo.js],
none: %w[ee/changelogs/foo.yml foo.md],
qa: %w[qa/foo],
@ -173,8 +173,13 @@ describe Gitlab::Danger::Helper do
'ee/FOO_VERSION' | :unknown
'db/foo' | :database
'ee/db/foo' | :database
'db/schema.rb' | :database
'db/migrate/foo' | :database
'db/post_migrate/foo' | :database
'ee/db/migrate/foo' | :database
'ee/db/post_migrate/foo' | :database
'ee/db/geo/migrate/foo' | :database
'ee/db/geo/post_migrate/foo' | :database
'app/models/project_authorization.rb' | :database
'app/services/users/refresh_authorized_projects_service.rb' | :database
'lib/gitlab/background_migration.rb' | :database
@ -188,6 +193,9 @@ describe Gitlab::Danger::Helper do
'lib/gitlab/sql/foo' | :database
'rubocop/cop/migration/foo' | :database
'db/fixtures/foo.rb' | :backend
'ee/db/fixtures/foo.rb' | :backend
'qa/foo' | :qa
'ee/qa/foo' | :qa