Commit 1e016936 authored by Josianne Hyson's avatar Josianne Hyson

Rename CsvIssueImport to Issues::CsvImport

We want to namespace relevant concepts so that it is easier to
understand the role of similarly, or ambiguously named concepts. Rename
CsvIssueImport to Issues::CsvImport which was recently introduced in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44742 so that it
aligns with this ideal.

Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/270428
parent 4b25abb4
# frozen_string_literal: true
class CsvIssueImport < ApplicationRecord
class Issues::CsvImport < ApplicationRecord
self.table_name = 'csv_issue_imports'
belongs_to :project, optional: false
belongs_to :user, optional: false
end
......@@ -20,7 +20,7 @@ module Issues
private
def record_import_attempt
CsvIssueImport.create!(user: @user, project: @project)
Issues::CsvImport.create!(user: @user, project: @project)
end
def process_csv
......
......@@ -602,7 +602,7 @@ module Gitlab
jira: distinct_count(::JiraImportState.where(time_period), :user_id),
fogbugz: projects_imported_count('fogbugz', time_period),
phabricator: projects_imported_count('phabricator', time_period),
csv: distinct_count(CsvIssueImport.where(time_period), :user_id)
csv: distinct_count(Issues::CsvImport.where(time_period), :user_id)
},
groups_imported: distinct_count(::GroupImportState.where(time_period), :user_id)
}
......
# frozen_string_literal: true
FactoryBot.define do
factory :csv_issue_import do
factory :issue_csv_import, class: 'Issues::CsvImport' do
project
user
end
......
......@@ -212,7 +212,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
jira_project = create(:project, creator_id: user.id)
create(:jira_import_state, :finished, project: jira_project)
create(:csv_issue_import, user: user)
create(:issue_csv_import, user: user)
end
expect(described_class.usage_activity_by_stage_manage({})).to include(
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe CsvIssueImport, type: :model do
RSpec.describe Issues::CsvImport, type: :model do
describe 'associations' do
it { is_expected.to belong_to(:project).required }
it { is_expected.to belong_to(:user).required }
......
......@@ -16,7 +16,7 @@ RSpec.describe Issues::ImportCsvService do
shared_examples_for 'an issue importer' do
it 'records the import attempt' do
expect { subject }
.to change { CsvIssueImport.where(project: project, user: user).count }
.to change { Issues::CsvImport.where(project: project, user: user).count }
.by 1
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