|
153 | 153 | let(:video_id) { 'NNUlOLaupuw' } |
154 | 154 |
|
155 | 155 | it 'returns all the end screen annotations' do |
156 | | - expect(annotations.size).to be 5 # [0] is Featured |
| 156 | + expect(annotations.size).to be 4 |
| 157 | + |
| 158 | + expect(annotations[0]).to be_a Yt::Annotations::EndScreen |
| 159 | + expect(annotations[0].starts_at).to be 25.312 |
| 160 | + expect(annotations[0].ends_at).to be 35.005 |
| 161 | + expect(annotations[0].text).to eq 'PewDiePie' |
| 162 | + expect(annotations[0].link).to be_a Hash |
| 163 | + expect(annotations[0].link[:url]).to eq 'https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw' |
| 164 | + expect(annotations[0].link[:type]).to be :channel |
| 165 | + expect(annotations[0].link[:new_window]).to be true |
157 | 166 |
|
158 | 167 | expect(annotations[1]).to be_a Yt::Annotations::EndScreen |
159 | | - expect(annotations[1].starts_at).to be 25.312 |
| 168 | + expect(annotations[1].starts_at).to be 25.962 |
160 | 169 | expect(annotations[1].ends_at).to be 35.005 |
161 | | - expect(annotations[1].text).to eq 'PewDiePie' |
| 170 | + expect(annotations[1].text).to eq 'T-Shirt Shop for Geeks, Gamer, Nerds' |
162 | 171 | expect(annotations[1].link).to be_a Hash |
163 | | - expect(annotations[1].link[:url]).to eq 'https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw' |
164 | | - expect(annotations[1].link[:type]).to be :channel |
| 172 | + expect(annotations[1].link[:url]).to eq 'https://3dsupply.de/en/' |
| 173 | + expect(annotations[1].link[:type]).to be :website |
165 | 174 | expect(annotations[1].link[:new_window]).to be true |
166 | 175 |
|
167 | 176 | expect(annotations[2]).to be_a Yt::Annotations::EndScreen |
168 | | - expect(annotations[2].starts_at).to be 25.962 |
169 | | - expect(annotations[2].ends_at).to be 35.005 |
170 | | - expect(annotations[2].text).to eq 'T-Shirt Shop for Geeks, Gamer, Nerds' |
| 177 | + expect(annotations[2].starts_at).to be 26.741 |
| 178 | + expect(annotations[2].ends_at).to be 35.015 |
| 179 | + expect(annotations[2].text).to eq 'PSY - GANGNAM STYLE(강남스타일) M/V' |
171 | 180 | expect(annotations[2].link).to be_a Hash |
172 | | - expect(annotations[2].link[:url]).to eq 'https://3dsupply.de/en/' |
173 | | - expect(annotations[2].link[:type]).to be :website |
174 | | - expect(annotations[2].link[:new_window]).to be true |
| 181 | + expect(annotations[2].link[:url]).to eq 'https://www.youtube.com/watch?v=9bZkp7q19f0' |
| 182 | + expect(annotations[2].link[:type]).to be :video |
| 183 | + expect(annotations[2].link[:new_window]).to be false |
175 | 184 |
|
176 | 185 | expect(annotations[3]).to be_a Yt::Annotations::EndScreen |
177 | | - expect(annotations[3].starts_at).to be 26.741 |
178 | | - expect(annotations[3].ends_at).to be 35.015 |
179 | | - expect(annotations[3].text).to eq 'PSY - GANGNAM STYLE(강남스타일) M/V' |
| 186 | + expect(annotations[3].starts_at).to be 27.287 |
| 187 | + expect(annotations[3].ends_at).to be 35.031 |
| 188 | + expect(annotations[3].text).to eq 'First public playlist' |
180 | 189 | expect(annotations[3].link).to be_a Hash |
181 | | - expect(annotations[3].link[:url]).to eq 'https://www.youtube.com/watch?v=9bZkp7q19f0' |
182 | | - expect(annotations[3].link[:type]).to be :video |
| 190 | + expect(annotations[3].link[:url]).to include 'list=PL-LeTutc9GRKD3yBDhnRF_yE8UTaQI5Jf' |
| 191 | + expect(annotations[3].link[:type]).to be :playlist |
183 | 192 | expect(annotations[3].link[:new_window]).to be false |
184 | | - |
185 | | - expect(annotations[4]).to be_a Yt::Annotations::EndScreen |
186 | | - expect(annotations[4].starts_at).to be 27.287 |
187 | | - expect(annotations[4].ends_at).to be 35.031 |
188 | | - expect(annotations[4].text).to eq 'First public playlist' |
189 | | - expect(annotations[4].link).to be_a Hash |
190 | | - expect(annotations[4].link[:url]).to include 'list=PL-LeTutc9GRKD3yBDhnRF_yE8UTaQI5Jf' |
191 | | - expect(annotations[4].link[:type]).to be :playlist |
192 | | - expect(annotations[4].link[:new_window]).to be false |
193 | 193 | end |
194 | 194 | end |
195 | 195 |
|
196 | | - context 'given another video with endscreen' do |
| 196 | + context 'given another video with end screen' do |
197 | 197 | let(:video_id) { 'EuqmXkjhisE' } |
198 | 198 |
|
199 | 199 | it 'returns an end screen annotation with subscribe type' do |
200 | | - expect(annotations[1]).to be_a Yt::Annotations::EndScreen |
201 | | - expect(annotations[1].link[:type]).to be :subscribe |
202 | | - end |
203 | | - end |
204 | | - |
205 | | - context 'given a video without cards and with a featured playlist' do |
206 | | - let(:video_id) { 'GFxm7khsS3g' } |
207 | | - |
208 | | - it 'also returns the featured playlist' do |
209 | | - expect(annotations.size).to be 1 |
210 | | - |
211 | | - expect(annotations[0]).to be_a Yt::Annotations::Featured |
212 | | - expect(annotations[0].starts_at).to be 1.0 |
213 | | - expect(annotations[0].ends_at).to be 5.0 |
214 | | - expect(annotations[0].text).to eq 'Check this playlist: Adorable Kids' |
215 | | - expect(annotations[0].link).to be_a Hash |
216 | | - expect(annotations[0].link[:url]).to include 'list=PLuW4g7xujBWfU26JUTW1DGs3hk4LD5KaL' |
217 | | - expect(annotations[0].link[:type]).to be :playlist |
218 | | - expect(annotations[0].link[:new_window]).to be true |
219 | | - end |
220 | | - end |
221 | | - |
222 | | - context 'given a video without cards and with a featured video' do |
223 | | - let(:video_id) { 'PaOOnucHLA4' } |
224 | | - |
225 | | - it 'also returns the featured video' do |
226 | | - expect(annotations.size).to be 1 |
227 | | - |
228 | | - expect(annotations[0]).to be_a Yt::Annotations::Featured |
229 | | - expect(annotations[0].starts_at).to be 0.0 |
230 | | - expect(annotations[0].ends_at).to be 3.0 |
231 | | - expect(annotations[0].text).to eq 'Check out this video: Me at the zoo' |
232 | | - expect(annotations[0].link).to be_a Hash |
233 | | - expect(annotations[0].link[:url]).to include 'v=jNQXAC9IVRw' |
234 | | - expect(annotations[0].link[:type]).to be :video |
235 | | - expect(annotations[0].link[:new_window]).to be true |
| 200 | + expect(annotations[2]).to be_a Yt::Annotations::EndScreen |
| 201 | + expect(annotations[2].link[:type]).to be :subscribe |
236 | 202 | end |
237 | 203 | end |
238 | 204 |
|
|
0 commit comments