Skip to content

Commit

Permalink
Test with released Rails 4.2 stable branch
Browse files Browse the repository at this point in the history
The released 4.2.0 contains a bug that does not correctly verify the
response status code to determine whether to include the body content
and remove content headers in case of head requests like 204 no content.

It is not a big deal and it's unlikely to affect many people, but running
responders tests against 4.2.0 fails some tests returning a body with a space
" ", where we expect an empty one "", and the stable branch already
contains the necessary fixes:

rails/rails@bc1760f
rails/rails@2910956

This does not affect the use of responders with 4.2.0.
  • Loading branch information
carlosantoniodasilva committed Jan 1, 2015
1 parent a19c9b9 commit c3e2d04
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 83 deletions.
8 changes: 2 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ source 'https://rubygems.org'

gemspec

# gem 'railties', '~> 4.2.0-alpha'
# gem 'activemodel', '~> 4.2.0-alpha'
gem 'rails', github: 'rails/rails'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'rack', github: 'rack/rack'
gem 'arel', github: 'rails/arel'
gem 'railties', '~> 4.2.0', github: 'rails/rails', branch: '4-2-stable'
gem 'activemodel', '~> 4.2.0', github: 'rails/rails', branch: '4-2-stable'
gem 'mocha'
113 changes: 40 additions & 73 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,113 +1,80 @@
GIT
remote: git://github.com/rack/rack.git
revision: 92811eec6e86cb4dba52b3969c4dd66e639df158
specs:
rack (1.6.0.alpha)

GIT
remote: git://github.com/rails/arel.git
revision: 66cee768bc163537087037a583f60639eae49fc3
specs:
arel (6.0.0.20140505020427)

GIT
remote: git://github.com/rails/rails.git
revision: bf5b6969682394c3f71daa6e9962c86f4bf71059
revision: 2910956fc9006d3c26f56992dab630fa97b7f7bc
branch: 4-2-stable
specs:
actionmailer (4.2.0.alpha)
actionpack (= 4.2.0.alpha)
actionview (= 4.2.0.alpha)
mail (~> 2.5, >= 2.5.4)
actionpack (4.2.0.alpha)
actionview (= 4.2.0.alpha)
activesupport (= 4.2.0.alpha)
rack (~> 1.6.0.alpha)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
actionview (4.2.0.alpha)
activesupport (= 4.2.0.alpha)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.2.0.alpha)
activesupport (= 4.2.0.alpha)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0.alpha)
activemodel (= 4.2.0.alpha)
activesupport (= 4.2.0.alpha)
arel (~> 6.0.0)
activesupport (4.2.0.alpha)
i18n (>= 0.7.0.dev, < 0.8)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
rails (4.2.0.alpha)
actionmailer (= 4.2.0.alpha)
actionpack (= 4.2.0.alpha)
actionview (= 4.2.0.alpha)
activemodel (= 4.2.0.alpha)
activerecord (= 4.2.0.alpha)
activesupport (= 4.2.0.alpha)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0.alpha)
sprockets-rails (~> 2.1)
railties (4.2.0.alpha)
actionpack (= 4.2.0.alpha)
activesupport (= 4.2.0.alpha)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)

GIT
remote: git://github.com/svenfuchs/i18n.git
revision: cb679b8cdbab675703a3f88de4d48a48f7b50e06
specs:
i18n (0.7.0.dev)

PATH
remote: .
specs:
responders (2.0.2)
railties (>= 4.2.0.alpha, < 5)
railties (>= 4.2.0, < 5)

GEM
remote: https://rubygems.org/
specs:
builder (3.2.2)
erubis (2.7.0)
hike (1.2.3)
i18n (0.7.0)
json (1.8.1)
mail (2.6.1)
mime-types (>= 1.16, < 3)
loofah (2.0.1)
nokogiri (>= 1.5.9)
metaclass (0.0.4)
mime-types (2.3)
minitest (5.4.0)
mini_portile (0.6.2)
minitest (5.5.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
multi_json (1.10.1)
nokogiri (1.6.5)
mini_portile (~> 0.6.0)
rack (1.6.0)
rack-test (0.6.2)
rack (>= 1.0)
rake (10.3.2)
sprockets (2.12.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.1.3)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
rake (10.4.2)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
arel!
i18n!
activemodel (~> 4.2.0)!
mocha
rack!
rails!
railties (~> 4.2.0)!
responders!
4 changes: 2 additions & 2 deletions lib/action_controller/respond_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def respond_with(*resources, &block)
mimes = collect_mimes_from_class_level()
collector = ActionController::MimeResponds::Collector.new(mimes, request.variant)
block.call(collector) if block_given?

if format = collector.negotiate_format(request)
_process_format(format)
options = resources.size == 1 ? {} : resources.extract_options!
Expand Down Expand Up @@ -226,4 +226,4 @@ def collect_mimes_from_class_level #:nodoc:
end
end
end
end
end
2 changes: 1 addition & 1 deletion responders.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Gem::Specification.new do |s|
s.files = Dir["CHANGELOG.md", "MIT-LICENSE", "README.md", "lib/**/*"]
s.require_paths = ["lib"]

s.add_dependency "railties", ">= 4.2.0.alpha", "< 5"
s.add_dependency "railties", ">= 4.2.0", "< 5"
end
2 changes: 1 addition & 1 deletion test/responders/http_cache_responder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_returns_not_modified_if_return_is_cache_is_still_valid
@request.env["HTTP_IF_MODIFIED_SINCE"] = Time.utc(2009, 6).httpdate
get :single
assert_equal 304, @response.status
assert_includes [" ", ""], @response.body
assert_includes "", @response.body
end

def test_refreshes_last_modified_if_cache_is_expired
Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ApplicationController < ActionController::Base
end

class ActiveSupport::TestCase
self.test_order = :random

setup do
@routes = Responders::Routes
end
Expand Down

0 comments on commit c3e2d04

Please sign in to comment.