require "spec_helper"


module Embedly
  describe API do
    let(:api) { API.new :key => ENV['EMBEDLY_KEY'], :secret => ENV['EMBEDLY_SECRET'] }

    describe "logger" do
      let(:io) { StringIO.new }

      before do
        Embedly.configure do |c|
          c.debug  = true
          c.logger = Logger.new(io)
        end
      end

      it "logs if debug is enabled" do
        api.oembed :url => 'http://blog.doki-pen.org/'
        io.string.should =~ %r{.*DEBUG -- : .*}
      end
    end

    describe "requesters" do
      describe "net/http" do
        before do
          Embedly.configure { |c| c.request_with :net_http }
        end

        it "sets the correct request adapter" do
          api.request.should be_a(Embedly::NetHTTP::Request)
        end
      end

      describe "typhoeus" do
        before do
          Embedly.configure { |c| c.request_with :typhoeus }
        end

        it "sets the correct request adapter" do
          api.request.should be_a(Embedly::Typhoeus::Request)
        end
      end
    end
  end
end

require "spec_helper"

module Embedly
  describe API do
    let(:api) { API.new :key => ENV['EMBEDLY_KEY'], :secret => ENV['EMBEDLY_SECRET'] }

    describe "logger" do
      let(:io) { StringIO.new }

      before do
        Embedly.configure do |c|
          c.debug  = true
          c.logger = Logger.new(io)
        end
      end

      it "logs if debug is enabled" do
        api.oembed :url => 'http://blog.doki-pen.org/'
        io.string.should =~ %r{.*DEBUG -- : .*}
      end
    end

    describe "requesters" do
      describe "net/http" do
        before do
          Embedly.configure { |c| c.request_with :net_http }
        end

        it "sets the correct request adapter" do
          api.request.should be_a(Embedly::NetHTTP::Request)
        end

        it "requests succesfully" do
          request = api.oembed :url => 'http://blog.doki-pen.org/'
          request.first.provider_url.should == 'http://posterous.com'
        end
      end

      describe "typhoeus" do
        before do
          Embedly.configure { |c| c.request_with :typhoeus }
        end

        it "sets the correct request adapter" do
          api.request.should be_a(Embedly::Typhoeus::Request)
        end

        it "requests succesfully" do
          request = api.oembed :url => 'http://blog.doki-pen.org/'
          request.first.provider_url.should == 'http://posterous.com'
        end
      end
    end
  end
end

--- 
+++ 
@@ -1,4 +1,5 @@
 require "spec_helper"
+
 
 module Embedly
   describe API do
@@ -29,11 +30,6 @@
         it "sets the correct request adapter" do
           api.request.should be_a(Embedly::NetHTTP::Request)
         end
-
-        it "requests succesfully" do
-          request = api.oembed :url => 'http://blog.doki-pen.org/'
-          request.first.provider_url.should == 'http://posterous.com'
-        end
       end
 
       describe "typhoeus" do
@@ -44,11 +40,6 @@
         it "sets the correct request adapter" do
           api.request.should be_a(Embedly::Typhoeus::Request)
         end
-
-        it "requests succesfully" do
-          request = api.oembed :url => 'http://blog.doki-pen.org/'
-          request.first.provider_url.should == 'http://posterous.com'
-        end
       end
     end
   end
Remove functional tests against api
