discourse/spec/lib/onebox/engine/slides_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

24 lines
685 B
Ruby

# frozen_string_literal: true
describe Onebox::Engine::SlidesOnebox do
let(:link) { "http://slides.com/drksephy/ecmascript-2015" }
let(:html) { described_class.new(link).to_html }
before do
stub_request(:get, link).to_return(status: 200, body: onebox_response("slides"))
end
describe "#placeholder_html" do
it "returns an image as the placeholder" do
expect(Onebox.preview(link).placeholder_html).to include("//s3.amazonaws.com/media-p.slid.es/thumbnails/secure/cff7c3/decks.jpg")
end
end
describe "#to_html" do
it "returns iframe embed" do
expect(html).to include(URI(link).path)
expect(html).to include("iframe")
end
end
end