Sha256: 78cdaaca93fb45ade7f9d8c66fd73ba287e4e14381edffc604700684a77248f5

Contents?: true

Size: 844 Bytes

Versions: 5

Compression:

Stored size: 844 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Oembedr do
  let(:test_url) { "http://www.youtube.com/watch?v=b9XsTtFu64Y" }
  let(:mock_client) { mock(Oembedr::Client, :ready? => true) }

  describe "#fetch" do
    it "leverages the Client class to retrieve an oembeddable resource from the given url" do
      Oembedr::Client.stub!(:new).and_return(mock_client)
      mock_client.should_receive(:get).with({})
      Oembedr.fetch test_url
    end
    it "passes any options through correctly" do
      Oembedr::Client.stub!(:new).and_return(mock_client)
      mock_client.should_receive(:get).with({ :maxwidth => 350 })
      Oembedr.fetch test_url, { :maxwidth => 350 }
    end
    it "returns false if there is no known service for the given URI" do
      Oembedr.fetch("http://jasdfasdfas.com").should be_false
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oembedr-1.1.1 spec/oembedr_spec.rb
oembedr-1.1.0 spec/oembedr_spec.rb
oembedr-1.0.0 spec/oembedr_spec.rb
oembedr-0.0.3 spec/oembedr_spec.rb
oembedr-0.0.2 spec/oembedr_spec.rb