Browse files

Changed default em-http-request version dependency to >= 1.0.0. Specs…

… against version 0.3.0 run on travis too.
  • Loading branch information...
1 parent 02a9c1d commit 1d4899aee622afe6810cfc296832223f200b2f69 @bblimke committed Jan 22, 2012
Showing with 41 additions and 39 deletions.
  1. +1 −1 .travis.yml
  2. +2 −3 Gemfile
  3. +2 −2 Rakefile
  4. +34 −32 spec/acceptance/em_http_request/em_http_request_spec.rb
  5. +2 −1 webmock.gemspec
View
2 .travis.yml
@@ -6,4 +6,4 @@ rvm:
- jruby
-script: "bundle exec rake JRUBY_OPTS='–server -Dnative.enabled=true' && rake em_http_request_1_x_spec"
+script: "bundle exec rake JRUBY_OPTS='–server -Dnative.enabled=true' && rake em_http_request_0_x_spec"
View
5 Gemfile
@@ -1,9 +1,8 @@
source 'http://rubygems.org/'
gemspec
-if ENV["EM_HTTP_REQUEST_1_X"]
- gem 'em-http-request', '>= 1.0.0'
- gem 'em-synchrony', '>= 1.0.0'
+if ENV["EM_HTTP_REQUEST_0_X"]
+ gem 'em-http-request', '~> 0.3.0'
end
View
4 Rakefile
@@ -26,8 +26,8 @@ RSpec::Core::RakeTask.new(:spec_http_without_webmock) do |t|
end
-task :em_http_request_1_x_spec do
- sh "EM_HTTP_REQUEST_1_X=true bundle install && bundle exec rspec spec/acceptance/em_http_request/em_http_request_spec.rb" if RUBY_VERSION >= "1.9.2"
+task :em_http_request_0_x_spec do
+ sh "EM_HTTP_REQUEST_0_X=true bundle install && bundle exec rspec spec/acceptance/em_http_request/em_http_request_spec.rb" if RUBY_VERSION <= "1.8.7"
end
require 'rake/testtask'
View
66 spec/acceptance/em_http_request/em_http_request_spec.rb
@@ -62,41 +62,43 @@ def response(resp)
end
# not pretty, but it works
- describe "with synchrony" do
- let(:webmock_em_http) { File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb")) }
-
- before(:each) do
- # need to reload the webmock em-http adapter after we require synchrony
- WebMock::HttpLibAdapters::EmHttpRequestAdapter.disable!
- $".delete webmock_em_http
- $".delete File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
- require 'em-synchrony'
- require 'em-synchrony/em-http'
- require File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
- end
+ if defined?(EventMachine::Synchrony)
+ describe "with synchrony" do
+ let(:webmock_em_http) { File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb")) }
+
+ before(:each) do
+ # need to reload the webmock em-http adapter after we require synchrony
+ WebMock::HttpLibAdapters::EmHttpRequestAdapter.disable!
+ $".delete webmock_em_http
+ $".delete File.expand_path(File.join(File.dirname(__FILE__), "../../../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
+ require 'em-synchrony'
+ require 'em-synchrony/em-http'
+ require File.expand_path(File.join(File.dirname(__FILE__), "../../../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
+ end
- it "should work" do
- stub_request(:post, /.*.testserver.com*/).to_return(:status => 200, :body => 'ok')
- lambda {
- EM.run do
- fiber = Fiber.new do
- http = EM::HttpRequest.new("http://www.testserver.com").post :body => "foo=bar&baz=bang", :timeout => 60
- EM.stop
+ it "should work" do
+ stub_request(:post, /.*.testserver.com*/).to_return(:status => 200, :body => 'ok')
+ lambda {
+ EM.run do
+ fiber = Fiber.new do
+ http = EM::HttpRequest.new("http://www.testserver.com").post :body => "foo=bar&baz=bang", :timeout => 60
+ EM.stop
+ end
+ fiber.resume
end
- fiber.resume
- end
- }.should_not raise_error
- end
+ }.should_not raise_error
+ end
- after(:each) do
- EM.send(:remove_const, :Synchrony)
- EM.send(:remove_const, :HTTPMethods)
- WebMock::HttpLibAdapters::EmHttpRequestAdapter.disable!
- $".reject! {|path| path.include? "em-http-request"}
- $".delete webmock_em_http
- $".delete File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
- require 'em-http-request'
- require File.expand_path(File.join(File.dirname(__FILE__), "../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
+ after(:each) do
+ EM.send(:remove_const, :Synchrony)
+ EM.send(:remove_const, :HTTPMethods)
+ WebMock::HttpLibAdapters::EmHttpRequestAdapter.disable!
+ $".reject! {|path| path.include? "em-http-request"}
+ $".delete webmock_em_http
+ $".delete File.expand_path(File.join(File.dirname(__FILE__), "../../../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
+ require 'em-http-request'
+ require File.expand_path(File.join(File.dirname(__FILE__), "../../../lib/webmock/http_lib_adapters/em_http_request_adapter.rb"))
+ end
end
end
end
View
3 webmock.gemspec
@@ -20,7 +20,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec', '>= 2.0.0'
s.add_development_dependency 'httpclient', '>= 2.2.4'
s.add_development_dependency 'patron', '>= 0.4.17'
- s.add_development_dependency 'em-http-request', '~> 0.3.0'
+ s.add_development_dependency 'em-http-request', '>= 1.0.0'
+ s.add_development_dependency 'em-synchrony', '>= 1.0.0' if RUBY_VERSION >= "1.9"
s.add_development_dependency 'curb', '>= 0.8.0'
s.add_development_dependency 'typhoeus', '>= 0.3.0'
s.add_development_dependency 'minitest', '>= 2.2.2'

0 comments on commit 1d4899a

Please sign in to comment.