Skip to content

Commit

Permalink
update em-http driver to match new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
igrigorik committed Feb 9, 2011
1 parent f59169c commit ddf5840
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -4,7 +4,7 @@ gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'

group :development do
gem 'rspec', '~> 2.0.0'
gem 'em-http-request'
gem 'em-http-request', :git => 'git://github.com/igrigorik/em-http-request'
gem 'remcached'
gem 'em-mongo'
gem 'bson_ext'
Expand Down
1 change: 0 additions & 1 deletion em-synchrony.gemspec
Expand Up @@ -13,7 +13,6 @@ Gem::Specification.new do |s|

s.rubyforge_project = "em-synchrony"

s.required_ruby_version = Gem::Requirement.new(">= 1.9")
s.add_runtime_dependency("eventmachine", [">= 0.12.9"])

s.files = `git ls-files`.split("\n")
Expand Down
2 changes: 1 addition & 1 deletion lib/em-synchrony/em-http.rb
Expand Up @@ -5,7 +5,7 @@
end

module EventMachine
class HttpRequest
module HTTPMethods
%w[get head post delete put].each do |type|
class_eval %[
alias :a#{type} :#{type}
Expand Down
12 changes: 12 additions & 0 deletions spec/http_spec.rb
Expand Up @@ -4,6 +4,18 @@
DELAY = 0.25

describe EventMachine::HttpRequest do
it "should perform a synchronous fetch" do
EM.synchrony do
s = StubServer.new("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nFoo", DELAY)

r = EventMachine::HttpRequest.new(URL).get
r.response.should == 'Foo'

s.stop
EventMachine.stop
end
end

it "should fire sequential requests" do
EventMachine.synchrony do
s = StubServer.new("HTTP/1.0 200 OK\r\nConnection: close\r\n\r\nFoo", DELAY)
Expand Down

0 comments on commit ddf5840

Please sign in to comment.