Skip to content

Commit

Permalink
Fix tests flakyness
Browse files Browse the repository at this point in the history
- Correct the bounds for end time and start time between lesson and
  section based on the related lesson
- Add sequence to the name of the instrument to skip collisions with
  fixtures. System test rely on the fixtures so for now this should
  suffice.
  • Loading branch information
mauriciofierrom committed Jul 29, 2024
1 parent db1c639 commit 98c0043
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/factories/instrument.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FactoryBot.define do
factory :instrument do
name { Faker::Music.instrument }
sequence(:name) { |n| "#{Faker::Music.instrument}-#{n}" }
end
end
2 changes: 1 addition & 1 deletion spec/factories/lesson.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
end
video_url { Faker::Internet.url(host: "youtu.be", scheme: "https") }
duration_in_seconds do
Faker::Number.between(from: 0, to: 5.minutes.seconds)
Faker::Number.between(from: 1, to: 5.minutes.seconds)
end
instrument
user
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

end_time_hour { 0 }
end_time_minute { 0 }
end_time_second { Faker::Number.between(from: 1, to: 59 ) }
end_time_second { Faker::Number.between(from: 2, to: [lesson.duration_in_seconds, 50].min ) }

playback_speed { 0.5.step(by: 0.5, to: 2.0).to_a.sample }
end
Expand Down

0 comments on commit 98c0043

Please sign in to comment.