Skip to content

Commit

Permalink
[1980] Set personal_qualities and other_requirements to nil during ro…
Browse files Browse the repository at this point in the history
…llover
  • Loading branch information
avinhurry committed Jul 8, 2024
1 parent 5b067f6 commit d540b20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
6 changes: 2 additions & 4 deletions app/services/enrichments/copy_to_course_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ module Enrichments
class CopyToCourseService
def execute(enrichment:, new_course:)
new_enrichment = enrichment.dup
new_json_data = new_enrichment.json_data.dup
new_json_data.delete('PersonalQualities')
new_json_data.delete('OtherRequirements')
new_enrichment.json_data = new_json_data
new_enrichment.personal_qualities = nil
new_enrichment.other_requirements = nil
new_enrichment.last_published_timestamp_utc = nil
new_enrichment.rolled_over!
new_course.enrichments << new_enrichment
Expand Down
18 changes: 2 additions & 16 deletions spec/services/enrichments/copy_to_course_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,8 @@

its(:about_course) { is_expected.to eq published_enrichment.about_course }
its(:last_published_timestamp_utc) { is_expected.to be_nil }
its(:other_requirements) { is_expected.to be_nil }
its(:personal_qualities) { is_expected.to be_nil }
it { is_expected.to be_rolled_over }

it 'removes PersonalQualities from the json_data' do
expect(subject.json_data).not_to have_key('PersonalQualities')
end

it 'removes OtherRequirements from the json_data' do
expect(subject.json_data).not_to have_key('OtherRequirements')
end

it 'sets other_requirements to nil' do
expect(subject.other_requirements).to be_nil
end

it 'sets personal_qualities to nil' do
expect(subject.personal_qualities).to be_nil
end
end
end

0 comments on commit d540b20

Please sign in to comment.