Skip to content

Commit de6bd38

Browse files
committed
Less flaky author/copyright holder in import test
1 parent e92402c commit de6bd38

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

spec/routines/exercises/import/assessments_spec.rb

+3-9
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,8 @@
55
let(:book_uuid) { '62a49025-8cd8-407c-9cfb-c7eba55cf1c6' }
66
let(:fixture_path) { 'spec/fixtures/sample_import_assessments.xlsx' }
77

8-
before(:all) do
9-
DatabaseCleaner.start
10-
11-
2.times { FactoryBot.create :user, :agreed_to_terms }
12-
end
13-
after(:all) { DatabaseCleaner.clean }
14-
158
it 'imports exercises from the spreadsheet and adds Assignable tags' do
16-
author = User.find(1)
17-
copyright_holder = User.find(2)
9+
allow(User).to receive(:find) { FactoryBot.create :user, :agreed_to_terms }
1810

1911
allow_any_instance_of(OpenStax::Content::Book).to receive(:version).and_return('964da1b')
2012

@@ -35,6 +27,7 @@
3527
[stem_answer.answer.content, stem_answer.correctness.to_s, stem_answer.feedback]
3628
end)).to eq Set[['Right', '1.0', 'This is why A is correct'], ['Wrong', '0.0', 'This is why B is wrong']]
3729
expect(exercises[0].questions.first.collaborator_solutions.first.content).to eq 'Some solution'
30+
expect(exercises[0].publication.published_at?).to eq true
3831

3932
expect(Set.new exercises[1].tags.map(&:to_s)).to eq Set[
4033
'assessment:practice:https://openstax.org/orn/book:page/62a49025-8cd8-407c-9cfb-c7eba55cf1c6:6c30d0cc-e435-4081-be68-5ff2f558cbec',
@@ -47,5 +40,6 @@
4740
[stem_answer.answer.content, stem_answer.correctness.to_s, stem_answer.feedback]
4841
end)).to eq Set[['Not this one', '0.0', 'Better luck next time'], ['This one', '1.0', 'Good job']]
4942
expect(exercises[1].questions.first.collaborator_solutions.first.content).to eq 'Another solution'
43+
expect(exercises[1].publication.published_at?).to eq true
5044
end
5145
end

0 commit comments

Comments
 (0)