Permalink
Browse files

Get test suite working with Typheous 0.5.4

  • Loading branch information...
1 parent dbb09b3 commit fd4922af6a3c16a04508fd623d876da933620e8a @arsduo committed Jan 19, 2013
View
1 lib/koala/http_service.rb
@@ -1,5 +1,4 @@
require 'faraday'
-require 'typhoeus/adapters/faraday'
require 'koala/http_service/multipart_request'
require 'koala/http_service/uploadable_io'
require 'koala/http_service/response'
View
6 spec/cases/test_users_spec.rb
@@ -20,7 +20,7 @@
# Facebook only allows us 500 test users per app, so we have to clean up
# This would be a good place to clean up and accumulate all of them for
# later deletion.
- unless KoalaTest.mock_interface?
+ unless KoalaTest.mock_interface? || @stubbed
((@network || []) + [@user1, @user2]).each do |u|
puts "Unable to delete test user #{u.inspect}" if u && !(@test_users.delete(u) rescue false)
end
@@ -149,6 +149,7 @@
end
it "accepts http options" do
+ @stubbed = true
options = {:some_http_option => true}
@test_users.api.should_receive(:graph_call).with(anything, anything, anything, options)
@test_users.list(options)
@@ -178,6 +179,7 @@
it "lets you specify http options that get passed through to the graph call" do
options = {:some_http_option => true}
# technically this goes through delete_object, but this makes it less brittle
+ @stubbed = true
@test_users.graph_api.should_receive(:graph_call).with(anything, anything, anything, options)
@test_users.delete("user", options)
end
@@ -229,6 +231,7 @@
it "accepts an options hash" do
options = {:some_http_option => true}
+ @stubbed = true
@test_users2.graph_api.should_receive(:graph_call).with(anything, anything, anything, options)
@test_users2.update("foo", @updates, options)
end
@@ -269,6 +272,7 @@
it "accepts http options passed to both calls" do
options = {:some_http_option => true}
# should come twice, once for each user
+ @stubbed = true
Koala.http_service.should_receive(:make_request).with(anything, anything, anything, options).twice.and_return(Koala::HTTPService::Response.new(200, "{}", {}))
@test_users.befriend(@user1, @user2, options)
end
View
1 spec/support/graph_api_shared_examples.rb
@@ -343,7 +343,6 @@
@temporary_object_id.should_not be_nil
end
-
it "can post videos to the user's wall without an open file object" do
result = @api.put_video(@cat_movie, @content_type)
@temporary_object_id = result["id"]
View
1 spec/support/koala_test.rb
@@ -32,6 +32,7 @@ def self.setup_test_environment!
adapter = ENV['ADAPTER'] || "typhoeus" # use Typhoeus by default if available
begin
require adapter
+ require 'typhoeus/adapters/faraday' if adapter.to_s == "typhoeus"
Faraday.default_adapter = adapter.to_sym
rescue LoadError
puts "Unable to load adapter #{adapter}, using Net::HTTP."

0 comments on commit fd4922a

Please sign in to comment.