From 6df2963ad5125505f2c1f297da6e3d4b27124831 Mon Sep 17 00:00:00 2001 From: Jeremy Daer Date: Sun, 17 Apr 2016 21:34:42 -0700 Subject: [PATCH] CI: Refresh and repair builds * Fix incompatible backported specs * Pin to Rake < 11.0 for 1.8 compat * Switch to Travis container builds for newer Bundler * Fixes ye olde bundler/bundler#3559 * Allows us to use Bundler caching for faster builds * No longer needs sudo to manage packages * Build on Ruby 2.3 * Allow failures on jruby-head and rbx-2 --- .travis.yml | 31 +++++++++++++++++++++++++++---- Gemfile | 4 ++++ test/spec_handler.rb | 15 ++++++++++++--- test/spec_response.rb | 16 ++++++++-------- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e1ad9514..4a9d28e26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,43 @@ -before_install: sudo apt-get install lighttpd libfcgi-dev libmemcache-dev memcached -install: +language: ruby +sudo: false +cache: + - bundler + - apt + +services: + - memcached + +addons: + apt: + packages: + - lighttpd + - libfcgi-dev + +before_install: - gem env version | grep '^\(2\|1.\(8\|9\|[0-9][0-9]\)\)' || gem update --system - - bundle install --jobs=3 --retry=3 + script: bundle exec rake ci + rvm: - 1.8.7 - 1.9.2 - 1.9.3 - 2.0.0 - 2.1 - - 2.2 + - 2.2.4 + - 2.3.0 - ruby-head - rbx-2 - jruby + - jruby-9.0.4.0 - jruby-head - ree + notifications: email: false irc: "irc.freenode.org#rack" + +matrix: + allow_failures: + - rvm: rbx-2 + - rvm: jruby-head diff --git a/Gemfile b/Gemfile index d764d4029..a15d8702e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,10 @@ source 'https://rubygems.org' gemspec +# Rake 11+ is Ruby 1.9+ only. Stick with 10.x to avoid awkward Bundler +# platform and RUBY_VERSION gymnastics, or separate Gemfiles. +gem "rake", "< 11.0" + # What we need to do here is just *exclude* JRuby, but bundler has no way to do # this, because of some argument that I know I had with Yehuda and Carl years # ago, but I've since forgotten. Anyway, we actually need it here, and it's not diff --git a/test/spec_handler.rb b/test/spec_handler.rb index c252c1767..838416d13 100644 --- a/test/spec_handler.rb +++ b/test/spec_handler.rb @@ -23,10 +23,19 @@ class RockLobster; end lambda { Rack::Handler.get('boom') }.should.raise(LoadError) + end - lambda { - Rack::Handler.get('Object') - }.should.raise(LoadError) + should "raise LoadError if handler isn't nested under Rack::Handler" do + # Feature-detect whether Ruby can do non-inherited const lookups. + # If it can't, then Rack::Handler may lookup non-handler toplevel + # constants, so the best we can do is no-op here and not test it. + begin + Rack::Handler._const_get('Object', false) + rescue NameError + lambda { + Rack::Handler.get('Object') + }.should.raise(LoadError) + end end should "get unregistered, but already required, handler by name" do diff --git a/test/spec_response.rb b/test/spec_response.rb index 4a5ad9b59..5efdefdf1 100644 --- a/test/spec_response.rb +++ b/test/spec_response.rb @@ -100,13 +100,13 @@ it "can set SameSite cookies with symbol value :lax" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => :lax} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Lax" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Lax" end it "can set SameSite cookies with symbol value :Lax" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => :lax} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Lax" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Lax" end it "can set SameSite cookies with string value 'Lax'" do @@ -118,33 +118,33 @@ it "can set SameSite cookies with boolean value true" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => true} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Strict" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Strict" end it "can set SameSite cookies with symbol value :strict" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => :strict} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Strict" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Strict" end it "can set SameSite cookies with symbol value :Strict" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => :Strict} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Strict" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Strict" end it "can set SameSite cookies with string value 'Strict'" do response = Rack::Response.new response.set_cookie "foo", {:value => "bar", :same_site => "Strict"} - response["Set-Cookie"].must_equal "foo=bar; SameSite=Strict" + response["Set-Cookie"].should.equal "foo=bar; SameSite=Strict" end it "validates the SameSite option value" do response = Rack::Response.new lambda { response.set_cookie "foo", {:value => "bar", :same_site => "Foo"} - }.must_raise(ArgumentError). - message.must_match(/Invalid SameSite value: "Foo"/) + }.should.raise(ArgumentError). + message.should.match(/Invalid SameSite value: "Foo"/) end it "can set SameSite cookies with symbol value" do