Sha256: bcdb20358fe2c5c34770ff2df089444df964bd15244aaf716c8febfde598829e

Contents?: true

Size: 1.5 KB

Versions: 87

Compression:

Stored size: 1.5 KB

Contents

require "spec_helper"

describe Onebox::Engine::ImageOnebox do
  it "supports png" do
    expect(Onebox.preview('http://www.discourse.org/images/logo.png').to_s).to match(/<img/)
  end

  it "supports jpg" do
    expect(Onebox.preview('http://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg').to_s).to match(/<img/)
  end

  it "supports jpeg" do
    expect(Onebox.preview('http://upload.wikimedia.org/wikipedia/en/b/bb/Poster.jpeg').to_s).to match(/<img/)
  end

  it "supports gif" do
    expect(Onebox.preview('http://upload.wikimedia.org/wikipedia/commons/5/55/Tesseract.gif').to_s).to match(/<img/)
  end

  it "supports tif" do
    expect(Onebox.preview('http://www.fileformat.info/format/tiff/sample/1f37bbd5603048178487ec88b1a6425b/MARBLES.tif').to_s).to match(/<img/)
  end

  it "supports bmp" do
    expect(Onebox.preview('http://www.fileformat.info/format/bmp/sample/d4202a5fc22a48c388d9e1c636792cc6/LAND.BMP').to_s).to match(/<img/)
  end

  it "supports image URLs with query parameters" do
    expect(Onebox.preview('https://www.google.com/logos/doodles/2014/percy-julians-115th-birthday-born-1899-5688801926053888-hp.jpg?foo=bar').to_s).to match(/<img/)
  end

  it "supports protocol relative image URLs" do
    expect(Onebox.preview('//www.google.com/logos/doodles/2014/percy-julians-115th-birthday-born-1899-5688801926053888-hp.jpg').to_s).to match(/<img/)
  end

  it "includes a direct link to the image" do
    expect(Onebox.preview('http://www.discourse.org/images/logo.png').to_s).to match(/<a.*png/)
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
onebox-1.8.18 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.17 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.16 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.15 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.14 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.13 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.12 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.11 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.10 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.9 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.8 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.7 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.6 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.5 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.4 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.3 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.2 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.1 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.8.0 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.7.9 spec/lib/onebox/engine/image_onebox_spec.rb