Skip to content

Commit 1e0700c

Browse files
committed
Configure Faker randomness with RSpec seed
There are at least two flakey specs: * `spec/concepts/school_teacher/invite_spec.rb:14` [1] * `spec/concepts/project/create_remix_spec.rb:125` [2] I strongly suspect the extensive use of Faker in factories and spec setup and the randomness associated with it may be the root cause of the flakey specs. If nothing else it makes it hard to reproduce the spec failures locally. Configuring Faker's randomness with the same seed as RSpec is using and reporting should make it easier to reproduce any flakey specs in the future. [1]: https://github.com/RaspberryPiFoundation/editor-api/blob/f397e870f2a33cce1f53b9104c52314f5233572c/spec/concepts/school_teacher/invite_spec.rb#L14-L17 [2]: https://github.com/RaspberryPiFoundation/editor-api/blob/f397e870f2a33cce1f53b9104c52314f5233572c/spec/concepts/project/create_remix_spec.rb#L125-L128
1 parent 61664b7 commit 1e0700c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/support/faker.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.configure do |config|
4+
config.before(:suite) do
5+
puts "Faker randomized with seed #{config.seed}"
6+
Faker::Config.random = Random.new(config.seed)
7+
end
8+
end

0 commit comments

Comments
 (0)