Sha256: 237238ac11a569b34bdc171c3a2a1f0c86de4339aaa00dbcc9e6eb2d48225b45

Contents?: true

Size: 1.33 KB

Versions: 10

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe Instagram::Client do
  Instagram::Configuration::VALID_FORMATS.each do |format|
    context ".new(:format => '#{format}')" do
      before do
        @client = Instagram::Client.new(:format => format, :client_id => 'CID', :client_secret => 'CS', :access_token => 'AT')
      end

      describe ".oembed" do
        before do
          stub_get("oembed").
            with(:query => {:access_token => @client.access_token, :url => "http://instagram.com/p/abcdef"}).
            to_return(:body => fixture("oembed.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
        end

        it "should get the correct resource" do
          @client.oembed("http://instagram.com/p/abcdef")
          expect(a_get("oembed?url=http://instagram.com/p/abcdef").
            with(:query => {:access_token => @client.access_token})).
            to have_been_made
        end

        it "should return the oembed information for an instagram media url" do
          oembed = @client.oembed("http://instagram.com/p/abcdef")
          expect(oembed.media_id).to eq("123657555223544123_41812344")
        end

        it "should return nil if a URL is not provided" do
          oembed = @client.oembed
          expect(oembed).to be_nil
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
extendi-instagram-2.0.6 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.5 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.4 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.3 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.2 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.1 spec/instagram/client/embedding_spec.rb
extendi-instagram-2.0.0 spec/instagram/client/embedding_spec.rb
instagram-continued-1.3.0 spec/instagram/client/embedding_spec.rb
instagram-continued-1.2.1 spec/instagram/client/embedding_spec.rb
instagram-continued-1.2.0 spec/instagram/client/embedding_spec.rb