Skip to content

Commit d298bb8

Browse files
committed
Fix failing tests
1 parent 794baa6 commit d298bb8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

spec/routines/exercises/import/assessments_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@
3535
expect(exercises[0].publication_group.nickname).to eq 'Q1'
3636
expect(Set.new exercises[0].tags.map(&:to_s)).to eq Set[
3737
'assessment:preparedness:https://openstax.org/orn/book:page/62a49025-8cd8-407c-9cfb-c7eba55cf1c6:97af6b57-0004-4218-99c1-f2cfedea8f30',
38-
'context-cnxmod:97af6b57-0004-4218-99c1-f2cfedea8f30',
39-
'book-slug:college-success-concise',
4038
'machine-teks:dacf53a6-2b09-49f1-9926-de4efe1049e0',
41-
'module-slug:college-success-concise:1-1-why-college',
4239
'teks:T1.1',
4340
]
4441
expect(exercises[0].questions.first.stems.first.content).to eq 'Some question?'

spec/routines/exercises/tag/assessments_spec.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,38 @@
66
let(:book_uuid) { SecureRandom.uuid }
77
let(:page_uuid) { 'a9ce0e38-4f52-4fe0-9433-d8df95f6e3b2' }
88

9-
let(:expected_pre_tag) { "assessment:preparedness:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}" }
10-
let(:expected_post_tag) { "assessment:practice:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}" }
9+
let(:expected_pre_tag) { "assessment:preparedness:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}" }
10+
let(:expected_post_tag) { "assessment:practice:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}" }
11+
let(:expected_cnxmod_tag) { "context-cnxmod:#{page_uuid}" }
1112

1213
let!(:exercises) { (1..9).map { |ii| FactoryBot.create(:publication, number: ii).publishable } }
1314

1415
# Disable set_slug_tags!
1516
before { allow_any_instance_of(Exercise).to receive(:set_slug_tags!) }
1617

1718
it 'tags exercises with the sample spreadsheet' do
18-
expect { described_class.call(filename: fixture_path, book_uuid: book_uuid) }.to change { ExerciseTag.count }.by(10)
19+
expect do
20+
described_class.call(filename: fixture_path, book_uuid: book_uuid)
21+
end.to change { ExerciseTag.count }.by(15)
1922

2023
exercises.each(&:reload)
2124

2225
exercises.each do |exercise|
2326
valid_tags = []
2427
valid_tags << expected_pre_tag if exercise.number <= 5
25-
valid_tags << expected_post_tag if exercise.number >= 5
28+
valid_tags << [expected_post_tag, expected_cnxmod_tag] if exercise.number >= 5
2629

2730
expect(exercise.tags).to satisfy do |tags|
28-
expect(tags.length).to eq exercise.number == 5 ? 2 : 1
31+
expect(tags.length).to eq exercise.number < 5 ? 1 : exercise.number == 5 ? 3 : 2
2932
tags.all { |tag| expect(valid_tags).to include tag.name }
3033
end
3134
end
3235
end
3336

3437
it 'skips exercises with no changes (idempotence)' do
35-
expect { described_class.call(filename: fixture_path, book_uuid: book_uuid) }.to change { ExerciseTag.count }.by(10)
38+
expect do
39+
described_class.call(filename: fixture_path, book_uuid: book_uuid)
40+
end.to change { ExerciseTag.count }.by(15)
3641

3742
expect { described_class.call(filename: fixture_path, book_uuid: book_uuid) }.not_to change { ExerciseTag.count }
3843
end

0 commit comments

Comments
 (0)