discourse/spec/lib/onebox/engine/google_photos_onebox_spec.rb
David Taylor c9dab6fd08
DEV: Automatically require 'rails_helper' in all specs (#16077)
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors.

By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
2022-03-01 17:50:50 +00:00

23 lines
1.1 KiB
Ruby

# frozen_string_literal: true
describe Onebox::Engine::GooglePhotosOnebox do
let(:link) { "https://photos.app.goo.gl/pXA7T8zBX4WZWVMT7" }
let(:html) { described_class.new(link).to_html }
before do
stub_request(:get, link).to_return(status: 200, body: onebox_response("googlephotos"))
stub_request(:get, "https://photos.google.com/share/AF1QipOV3gcu_edA8lyjJEpS9sC1g3AeCUtaZox11ylYZId7wJ7cthZ8M1kZXeAp5vhEPg?key=QktmUFNvdWpNVktERU5zWmVRZlZubzRRc0ttWWN3")
.to_return(status: 200, body: onebox_response("googlephotos"))
stub_request(:head, "https://photos.google.com/share/AF1QipOV3gcu_edA8lyjJEpS9sC1g3AeCUtaZox11ylYZId7wJ7cthZ8M1kZXeAp5vhEPg?key=QktmUFNvdWpNVktERU5zWmVRZlZubzRRc0ttWWN3")
.to_return(status: 200, body: "")
end
it "includes album title" do
expect(html).to include("[3 new photos · Album by Arpit Jalan] Mesmerizing Singapore")
end
it "includes album poster image" do
expect(html).to include("https://lh3.googleusercontent.com/ZlYoleNnrVo8qdx0qEjKi_-_VXY7pqqCqIW-B88EMqJ0etibFw1kEu4bzo-T4jyOQ9Ey2ekADim_L3re4lT3aBmYJUwhjkEUb5Yk59YaCSy2R8AoME5Rx4wviDRgICllF8g6lsZnS8c=w600-h315-p-k")
end
end