Yes, I’m just struggling with the ruby test file. It doesn’t work and I don’t know why. I’ve never used/created unit testing before so…
The file that should be modified is discourse/youtube_onebox_spec.rb at 493d437e79f88ab9829a36fa000cc6107085e424 · discourse/discourse · GitHub
I’ve tried adding this at the bottom of the file:
it "can parse youtube shorts results" do
preview = expect(Onebox.preview('https://www.youtube.com/watch?v=wi2jAtpBl0Y').placeholder_html)
preview.to match(/reacts/)
preview.to match(/hqdefault/)
end
And also added this at the beginning of the file, in before do
:
stub_request(:get, "https://www.youtube.com/shorts/wi2jAtpBl0Y").to_return(status: 200, body: onebox_response("youtube-shorts"))`
I executed the tests with bin/rspec spec/lib/onebox/engine/youtube_onebox_spec.rb
But the test I added fails.
I don’t have the error message right now and I’ll be busy for the next few hours though.