Sha256: dd9f3eea18d2d33f2d1b576003407fd8e624cc8bf6296ac574883d3783951f7d

Contents?: true

Size: 1.47 KB

Versions: 34

Compression:

Stored size: 1.47 KB

Contents

require "spec_helper"

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

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

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

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

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

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

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

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

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

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
onebox-1.5.17 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.16 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.14 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.13 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.12 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.11 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.10 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.9 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.8 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.7 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.6 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.5 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.3 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.2 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.1 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.5.0 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.4.9 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.4.8 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.4.7 spec/lib/onebox/engine/image_onebox_spec.rb
onebox-1.4.5 spec/lib/onebox/engine/image_onebox_spec.rb