|
142 | 142 | end
|
143 | 143 | describe 'PATCH #update' do
|
144 | 144 | 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) } |
146 | 146 | let!(:playlist_item) { PlaylistItem.create!(playlist: playlist, clip: clip) }
|
147 | 147 |
|
148 | 148 | context 'with valid params' do
|
149 | 149 | it 'updates Playlist Item' do
|
150 | 150 | 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 |
152 | 152 | end.to change{ playlist_item.reload.title }
|
153 | 153 | end
|
154 | 154 | end
|
155 | 155 | context 'with invalid params' do
|
156 | 156 | it 'fails to update Playlist Item' do
|
157 | 157 | 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 |
159 | 159 | end.not_to change{ playlist_item.reload.title }
|
160 | 160 | end
|
161 | 161 | end
|
|
0 commit comments