Sha256: 66601571b370a348ddf0d44963cc58a38e8b31975c4b087eabd6b5ee803b83ed

Contents?: true

Size: 1.76 KB

Versions: 30

Compression:

Stored size: 1.76 KB

Contents

require "spec_helper"

describe Onebox::Engine::GoogleDocsOnebox do
  context "Spreadsheets" do
    let(:matcher) { described_class.new("https://docs.google.com/spreadsheets/d/SHEET_KEY/pubhtml") }

    it "should have spreadsheet class in html" do
      expect(matcher.to_html).to include "spreadsheet-onebox"
    end

    it "should be a spreadsheet" do
      expect(matcher.send(:spreadsheet?)).to be true
    end

    it "Should detect key" do
      expect(matcher.send(:key)).to eq 'SHEET_KEY'
    end
  end

  context "Documents" do
    let(:matcher) { described_class.new("https://docs.google.com/document/d/DOC_KEY/pub") }

    it "should have document class in html" do
      expect(matcher.to_html).to include "document-onebox"
    end

    it "should be a document" do
      expect(matcher.send(:document?)).to be true
    end

    it "Should detect key" do
      expect(matcher.send(:key)).to eq 'DOC_KEY'
    end
  end

  context "Presentaions" do
    let(:matcher) { described_class.new("https://docs.google.com/presentation/d/PRESENTATION_KEY/pub") }

    it "should have presentation class in html" do
      expect(matcher.to_html).to include "presentation-onebox"
    end

    it "should be a presentation" do
      expect(matcher.send(:presentation?)).to be true
    end

    it "Should detect key" do
      expect(matcher.send(:key)).to eq 'PRESENTATION_KEY'
    end
  end

  context "Forms" do
    let(:matcher) { described_class.new("https://docs.google.com/forms/d/FORMS_KEY/viewform") }

    it "should have forms class in html" do
      expect(matcher.to_html).to include "forms-onebox"
    end

    it "should be a form" do
      expect(matcher.send(:forms?)).to be true
    end

    it "Should detect key" do
      expect(matcher.send(:key)).to eq 'FORMS_KEY'
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
onebox-1.5.45 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.44 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.43 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.42 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.41 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.40 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.39 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.38 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.37 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.36 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.35 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.34 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.33 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.32 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.31 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.30 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.29 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.28 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.27 spec/lib/onebox/engine/google_docs_onebox_spec.rb
onebox-1.5.26 spec/lib/onebox/engine/google_docs_onebox_spec.rb