Skip to content

Commit b60d7a5

Browse files
authored
Merge pull request #6555 from avalonmediasystem/flaky_tests
Use Faker.unique to avoid flaky tests
2 parents 00671f6 + 6a019ed commit b60d7a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

spec/controllers/playlist_items_controller_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@
142142
end
143143
describe 'PATCH #update' do
144144
let!(:video_master_file) { FactoryBot.create(:master_file, duration: "200000") }
145-
let!(:clip) { AvalonClip.create(master_file: video_master_file, title: Faker::Lorem.word, comment: Faker::Lorem.sentence, start_time: 1000, end_time: 2000) }
145+
let!(:clip) { AvalonClip.create(master_file: video_master_file, title: Faker::Lorem.unique.word, comment: Faker::Lorem.sentence, start_time: 1000, end_time: 2000) }
146146
let!(:playlist_item) { PlaylistItem.create!(playlist: playlist, clip: clip) }
147147

148148
context 'with valid params' do
149149
it 'updates Playlist Item' do
150150
expect do
151-
patch :update, params: { playlist_id: playlist.id, id: playlist_item.id, playlist_item: { title: Faker::Lorem.word, start_time:'00:20', end_time:'1:20' } }, session: valid_session
151+
patch :update, params: { playlist_id: playlist.id, id: playlist_item.id, playlist_item: { title: Faker::Lorem.unique.word, start_time:'00:20', end_time:'1:20' } }, session: valid_session
152152
end.to change{ playlist_item.reload.title }
153153
end
154154
end
155155
context 'with invalid params' do
156156
it 'fails to update Playlist Item' do
157157
expect do
158-
patch :update, params: { playlist_id: playlist.id, id: playlist_item.id, playlist_item: { title: Faker::Lorem.word, start_time:'00:20', end_time:'not-a-time' } }, session: valid_session
158+
patch :update, params: { playlist_id: playlist.id, id: playlist_item.id, playlist_item: { title: Faker::Lorem.unique.word, start_time:'00:20', end_time:'not-a-time' } }, session: valid_session
159159
end.not_to change{ playlist_item.reload.title }
160160
end
161161
end

0 commit comments

Comments
 (0)