spec/support/koala_test.rb in koala-1.6.0 vs spec/support/koala_test.rb in koala-1.7.0rc1

- old
+ new

@@ -30,10 +30,11 @@ # allow live tests with different adapters 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." end @@ -56,10 +57,17 @@ @token = KoalaTest.oauth_token Koala::Utils.stub(:deprecate) # never fire deprecation warnings end config.after :each do + # Clean up Koala config + Koala.configure do |config| + Koala::HTTPService::DEFAULT_SERVERS.each_pair do |k, v| + config.send("#{k}=", v) + end + end + # if we're working with a real user, clean up any objects posted to Facebook # no need to do so for test users, since they get deleted at the end if @temporary_object_id && KoalaTest.real_user? raise "Unable to locate API when passed temporary object to delete!" unless @api @@ -69,19 +77,20 @@ # clean up any objects we've posted result = (@api.delete_object(@temporary_object_id) rescue false) # if we errored out or Facebook returned false, track that puts "Unable to delete #{@temporary_object_id}: #{result} (probably a photo or video, which can't be deleted through the API)" unless result end + end end end def self.setup_test_data(data) # make data accessible to all our tests self.oauth_test_data = data["oauth_test_data"] self.subscription_test_data = data["subscription_test_data"] self.oauth_token = data["oauth_token"] - self.app_id = data["oauth_test_data"]["app_id"] + self.app_id = data["oauth_test_data"]["app_id"].to_s self.app_access_token = data["oauth_test_data"]["app_access_token"] self.secret = data["oauth_test_data"]["secret"] self.code = data["oauth_test_data"]["code"] self.session_key = data["oauth_test_data"]["session_key"]