Skip to content

Commit

Permalink
Copy field guide images via project copier
Browse files Browse the repository at this point in the history
  • Loading branch information
zwolf committed Oct 18, 2023
1 parent b7707fb commit 30b8a29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/project_copier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ProjectCopier
:tagged_resources,
:avatar,
:background,
{ active_workflows: %i[tutorials attached_images] }
{ active_workflows: %i[tutorials attached_images] },
{ field_guides: %i[attached_images] }
].freeze

def initialize(project_id, user_id)
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/project_copier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
field_guide = copied_project.field_guides.first
expect(field_guide.translations.first.language).to eq(project.primary_language)
end

it 'copies the field guide attached images' do
fg = create(:field_guide, project: project)
fg.attached_images << create(:medium, type: "field_guide_attached_image", linked: fg)
expect(copied_project.field_guides.first.attached_images[0]).to be_valid
end
end

context 'when a project has a project page' do
Expand Down

0 comments on commit 30b8a29

Please sign in to comment.