Sha256: 3fe6da59d62bf2bf60dcc12fd3eb48488c75c1d5bb4e3c2bd9d33a91035aeea3

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 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

5 entries across 5 versions & 2 rubygems

Version Path
instagram-continued-continued-1.5.0 spec/instagram/client/embedding_spec.rb
instagram-continued-1.4.0 spec/instagram/client/embedding_spec.rb
instagram-continued-1.3.3 spec/instagram/client/embedding_spec.rb
instagram-continued-1.3.2 spec/instagram/client/embedding_spec.rb
instagram-continued-1.3.1 spec/instagram/client/embedding_spec.rb