Skip to content

Commit b667632

Browse files
committed
Output debug inforrmation to help with intermittent test
This test has been intermittently failing. I want to see the details of the lessons in the database to see if there are clues as to where they might come from.
1 parent 24fad24 commit b667632

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

spec/lib/tasks/for_education_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,16 @@
7676
end
7777

7878
it 'adds two projects' do
79-
lesson = Lesson.where(school_id: school.id)
80-
expect(Project.where(lesson_id: lesson.pluck(:id)).length).to eq(2)
79+
lessons = Lesson.where(school_id: school.id)
80+
projects = Project.where(lesson_id: lessons.pluck(:id))
81+
82+
if projects.length != 2
83+
$stdout.puts('Debug info for intermittent test')
84+
lessons.each { |lesson| $stdout.puts(lesson.inspect) }
85+
projects.each { |project| $stdout.puts(project.inspect) }
86+
end
87+
88+
expect(projects.length).to eq(2)
8189
end
8290

8391
it 'assigns a teacher' do

0 commit comments

Comments
 (0)