Sha256: c3858caa2a78302d59c551d6914e337385fdd65395210a8a33b6a77576720d81

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 KB

Contents

require "spec_helper"

describe Onebox::Engine::ClassicGoogleMapsOnebox do
  describe 'long form url' do
    before do
      @link = "https://maps.google.ca/maps?q=Eiffel+Tower,+Avenue+Anatole+France,+Paris,+France&hl=en&sll=43.656878,-79.32085&sspn=0.932941,1.50238&oq=eiffel+&t=m&z=17&iwloc=A"
    end

    include_context "engines"
    it_behaves_like "an engine"

    describe "#to_html" do
      it "embeds the iframe to display the map" do
        expect(html).to include("iframe")
      end
    end
  end

  describe 'short form url' do
    let(:long_url) { "https://maps.google.ca/maps?q=Brooklyn+Bridge,+Brooklyn,+NY,+United+States&hl=en&sll=43.656878,-79.32085&sspn=0.932941,1.50238&oq=brooklyn+bridge&t=m&z=17&iwloc=A" }

    it "retrieves the long form url" do
      onebox = described_class.new("http://goo.gl/maps/XffUa")
      onebox.expects(:get_long_url).once.returns(long_url)
      expect(onebox.url).to eq(long_url)
    end
  end

  describe 'www form url' do
    let(:embed_url) { "https://maps.google.de/maps?t=h&ll=48.398499,9.992333&spn=0.0038338,0.0056322&dg=ntvb&output=embed" }

    it "retrieves the canonical url" do
      onebox = described_class.new("https://www.google.de/maps/@48.3932366,9.992333,663a,20y,41.43t/data=!3m1!1e3")
      onebox.expects(:get_canonical_url).once.returns(embed_url)
      expect(onebox.url).to eq(embed_url)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
onebox-1.5.14 spec/lib/onebox/engine/classic_google_maps_onebox_spec.rb
onebox-1.5.13 spec/lib/onebox/engine/classic_google_maps_onebox_spec.rb