Permalink
Browse files

Fixed em-http-requests specs to be compatible with latest changes in …

…em-http-request.
  • Loading branch information...
1 parent 1d4899a commit 59f80c2c7032f35ce91d81f6f8143d20b535d5f4 @bblimke committed Jan 22, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 spec/acceptance/em_http_request/em_http_request_spec_helper.rb
@@ -10,6 +10,7 @@ def http_request(method, uri, options = {}, &block)
head = options[:headers] || {}
response = nil
error = nil
+ error_set = false
uri = Addressable::URI.heuristic_parse(uri)
EventMachine.run {
request = EventMachine::HttpRequest.new("#{uri.normalize.to_s}")
@@ -20,6 +21,7 @@ def http_request(method, uri, options = {}, &block)
:head => head.merge('authorization' => [uri.user, uri.password])
}, &block)
http.errback {
+ error_set = true
error = if http.respond_to?(:errors)
http.errors
else
@@ -38,7 +40,7 @@ def http_request(method, uri, options = {}, &block)
}
@http = http
}
- raise error if error
+ raise error.to_s if error_set
response
end

0 comments on commit 59f80c2

Please sign in to comment.