diff --git a/lib/project_copier.rb b/lib/project_copier.rb index a4bbc5ed0..3edd513ea 100644 --- a/lib/project_copier.rb +++ b/lib/project_copier.rb @@ -1,7 +1,17 @@ class ProjectCopier attr_reader :project_to_copy, :user - EXCLUDE_ATTRIBUTES = %i[classifications_count launched_row_order beta_row_order].freeze + EXCLUDE_ATTRIBUTES = %i[ + classifications_count + classifiers_count + launch_date + completeness + activity + lock_version + launched_row_order + beta_row_order + ].freeze + INCLUDE_ASSOCIATIONS = [ :tutorials, :pages, diff --git a/spec/lib/project_copier_spec.rb b/spec/lib/project_copier_spec.rb index 4a01ceaf2..46cf657f8 100644 --- a/spec/lib/project_copier_spec.rb +++ b/spec/lib/project_copier_spec.rb @@ -41,6 +41,14 @@ expect(copied_project.configuration['source_project_id']).to be(project.id) end + it 'does not copy over excluded attributes' do + project_with_excluded_keys = create(:full_project, classifications_count: 3, classifiers_count: 2, launch_date: Date.yesterday, completeness: 0.5, activity: 1, lock_version: 8) + other_copied_project = described_class.new(project_with_excluded_keys.id, copyist.id).copy + ProjectCopier::EXCLUDE_ATTRIBUTES.each do |attr| + expect(other_copied_project[attr]).not_to eq(project_with_excluded_keys[attr]) + end + end + it 'creates Talk roles for the new project and its owner' do allow(TalkAdminCreateWorker).to receive(:perform_async) copied_project