Skip to content
Browse files

add `jruby?`, `ssl_mode?` test helpers

  • Loading branch information...
1 parent 9b3923f commit 79022619ac2284023f7c182d9f6cf44cac2c763e @mislav mislav committed Aug 16, 2012
View
4 test/adapters/em_synchrony_test.rb
@@ -15,6 +15,6 @@ def test_binds_local_socket
#put conn.get('/who-am-i').body
assert_equal host, conn.options[:bind][:host]
end
- end
- end unless RUBY_VERSION < '1.9' or (defined? RUBY_ENGINE and 'jruby' == RUBY_ENGINE)
+ end unless RUBY_VERSION < '1.9' or jruby?
+ end
end
View
2 test/adapters/integration.rb
@@ -96,7 +96,7 @@ def test_GET_sends_user_agent
end
def test_GET_ssl
- expected = (ENV['SSL'] == 'yes').to_s
+ expected = self.class.ssl_mode?.to_s
assert_equal expected, get('ssl').body
end
View
4 test/adapters/patron_test.rb
@@ -11,7 +11,7 @@ def adapter() :patron end
# https://github.com/toland/patron/issues/52
undef :test_GET_with_body
- end
+ end unless jruby?
- end unless defined? RUBY_ENGINE and 'jruby' == RUBY_ENGINE
+ end
end
View
4 test/adapters/typhoeus_test.rb
@@ -14,7 +14,7 @@ def test_binds_local_socket
conn = create_connection :request => { :bind => { :host => host } }
assert_equal host, conn.options[:bind][:host]
end
- end
- end unless defined? RUBY_ENGINE and 'jruby' == RUBY_ENGINE
+ end unless jruby?
+ end
end
View
8 test/helper.rb
@@ -69,5 +69,13 @@ def capture_warnings
$stderr = old
end
end
+
+ def self.jruby?
+ defined? RUBY_ENGINE and 'jruby' == RUBY_ENGINE
+ end
+
+ def self.ssl_mode?
+ ENV['SSL'] == 'yes'
+ end
end
end

0 comments on commit 7902261

Please sign in to comment.
Something went wrong with that request. Please try again.