Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add REPORT as valid HTTP verb #390

Merged
merged 7 commits into from
Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ language: ruby
sudo: false

before_install:
- gem install bundler
- gem update --system 2.6.8
- gem --version
- gem install bundler --version 1.13.7 --no-rdoc --no-ri
- bundle --version

bundler_args: --without development doc
install: bundle _1.13.7_ install --without development doc

script: bundle _1.13.7_ exec rake

env:
global:
- JRUBY_OPTS="$JRUBY_OPTS --debug"

rvm:
- jruby-9.1.6.0
- jruby-9.1.7.0
- 2.0.0
- 2.1
- 2.2
- 2.3.0
- 2.3.3
- 2.4.0

matrix:
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ group :test do
gem "backports"
gem "coveralls", :require => false
gem "simplecov", ">= 0.9"
gem "json", ">= 1.8.1"
gem "rubocop", "= 0.40.0"
gem "rspec", "~> 3.0"
gem "rspec-its"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ versions:
* Ruby 2.1.x
* Ruby 2.2.x
* Ruby 2.3.x
* JRuby 9.1.0.0
* JRuby 9.1.x.x

If something doesn't work on one of these versions, it's a bug.

Expand Down
3 changes: 3 additions & 0 deletions lib/http/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class UnsupportedSchemeError < RequestError; end
# RFC 3744: WebDAV Access Control Protocol
:acl,

# RFC 6352: vCard Extensions to WebDAV -- CardDAV
:report,

# RFC 5789: PATCH Method for HTTP
:patch,

Expand Down
34 changes: 17 additions & 17 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
# frozen_string_literal: true
# coding: utf-8

require "simplecov"
require "coveralls"
# Are we in a flaky environment?
FLAKY_ENV = defined?(JRUBY_VERSION) && ENV["CI"]

unless FLAKY_ENV
require "simplecov"
require "coveralls"

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)

SimpleCov.start do
add_filter "/spec/"
minimum_coverage 80
SimpleCov.start do
add_filter "/spec/"
minimum_coverage 80
end
end

require "http"
require "rspec/its"
require "support/capture_warning"

# Are we in a flaky environment?
def flaky_env?
defined?(JRUBY_VERSION) && ENV["CI"]
end

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
Expand All @@ -50,6 +49,7 @@ def flaky_env?
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.filter_run_excluding :flaky if FLAKY_ENV
config.run_all_when_everything_filtered = true

# Limits the available syntax to the non-monkey patched syntax that is recommended.
Expand Down
25 changes: 6 additions & 19 deletions spec/support/http_handling_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,15 @@
context "of 0" do
let(:read_timeout) { 0 }

it "times out" do
skip "flaky environment" if flaky_env?
it "times out", :flaky do
expect { response }.to raise_error(HTTP::TimeoutError, /Read/i)
end
end

context "of 2.5" do
let(:read_timeout) { 2.5 }

it "does not time out" do
# TODO: investigate sporadic JRuby timeouts on CI
skip "flaky environment" if flaky_env?

it "does not time out", :flaky do
expect { client.get("#{server.endpoint}/sleep").body.to_s }.to_not raise_error
end
end
Expand Down Expand Up @@ -96,10 +92,7 @@

let(:read_timeout) { 2.5 }

it "does not timeout" do
# TODO: investigate sporadic JRuby timeouts on CI
skip "flaky environment" if flaky_env?

it "does not timeout", :flaky do
client.get("#{server.endpoint}/sleep").body.to_s
client.get("#{server.endpoint}/sleep").body.to_s
end
Expand Down Expand Up @@ -130,9 +123,7 @@
end

context "on a mixed state" do
it "re-opens the connection" do
skip "flaky environment" if flaky_env?

it "re-opens the connection", :flaky do
first_socket_id = client.get("#{server.endpoint}/socket/1").body.to_s

client.instance_variable_set(:@state, :dirty)
Expand Down Expand Up @@ -163,9 +154,7 @@
end

context "with a socket issue" do
it "transparently reopens" do
skip "flaky environment" if flaky_env?

it "transparently reopens", :flaky do
first_socket_id = client.get("#{server.endpoint}/socket").body.to_s
expect(first_socket_id).to_not eq("")
# Kill off the sockets we used
Expand Down Expand Up @@ -195,9 +184,7 @@
context "when disabled" do
let(:options) { {} }

it "opens new sockets" do
skip "flaky environment" if flaky_env?

it "opens new sockets", :flaky do
expect(sockets_used).to_not include("")
expect(sockets_used.uniq.length).to eq(2)
end
Expand Down