Skip to content

Commit

Permalink
Bump to Rails 4.2.0 as that's the most recently supported Rails version
Browse files Browse the repository at this point in the history
This solves issues with json 1.8.3 not compiling against Ruby 2.4.1 etc.
  • Loading branch information
dhh committed Jun 5, 2017
1 parent 5207ff3 commit eb5d376
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 127 deletions.
33 changes: 0 additions & 33 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
appraise "rails-3-0" do
gem "test-unit"
gem "railties", "~> 3.0.0"
gem "actionpack", "~> 3.0.0"
gem "activemodel", "~> 3.0.0"
end

appraise "rails-3-1" do
gem "test-unit"
gem "railties", "~> 3.1.0"
gem "actionpack", "~> 3.1.0"
gem "activemodel", "~> 3.1.0"
end

appraise "rails-3-2" do
gem "test-unit"
gem "railties", "~> 3.2.0"
gem "actionpack", "~> 3.2.0"
gem "activemodel", "~> 3.2.0"
end

appraise "rails-4-0" do
gem "railties", "~> 4.0.0"
gem "actionpack", "~> 4.0.0"
gem "activemodel", "~> 4.0.0"
end

appraise "rails-4-1" do
gem "railties", "~> 4.1.0"
gem "actionpack", "~> 4.1.0"
gem "activemodel", "~> 4.1.0"
end

appraise "rails-4-2" do
gem "railties", "~> 4.2.0"
gem "actionpack", "~> 4.2.0"
Expand Down
6 changes: 1 addition & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ else

test.libs << "test"

if Rails::VERSION::MAJOR == 3
test.test_files = %w[test/jbuilder_template_test.rb test/jbuilder_test.rb]
else
test.test_files = FileList["test/*_test.rb"]
end
test.test_files = FileList["test/*_test.rb"]
end

task default: :test
Expand Down
14 changes: 0 additions & 14 deletions gemfiles/rails_3_0.gemfile

This file was deleted.

14 changes: 0 additions & 14 deletions gemfiles/rails_3_1.gemfile

This file was deleted.

14 changes: 0 additions & 14 deletions gemfiles/rails_3_2.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4_0.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4_1.gemfile

This file was deleted.

5 changes: 2 additions & 3 deletions gemfiles/rails_4_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
source "https://rubygems.org"

gem "rake"
gem "mocha", :require => false
gem "mocha", require: false
gem "appraisal"
gem "pry"
gem "railties", "~> 4.2.0"
gem "actionpack", "~> 4.2.0"
gem "activemodel", "~> 4.2.0"
gem "nokogiri", "< 1.7" if RUBY_VERSION < "2.1"

gemspec :path => "../"
gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/rails_5_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
source "https://rubygems.org"

gem "rake"
gem "mocha", :require => false
gem "mocha", require: false
gem "appraisal"
gem "pry"
gem "railties", "~> 5.0.0"
gem "actionpack", "~> 5.0.0"
gem "activemodel", "~> 5.0.0"

gemspec :path => "../"
gemspec path: "../"
4 changes: 2 additions & 2 deletions gemfiles/rails_5_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
source "https://rubygems.org"

gem "rake"
gem "mocha", :require => false
gem "mocha", require: false
gem "appraisal"
gem "pry"
gem "railties", ">= 5.1.0", "< 5.2"
gem "actionpack", ">= 5.1.0", "< 5.2"
gem "activemodel", ">= 5.1.0", "< 5.2"

gemspec :path => "../"
gemspec path: "../"
2 changes: 1 addition & 1 deletion jbuilder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 1.9.3'

s.add_dependency 'activesupport', '>= 4.0.0'
s.add_dependency 'activesupport', '>= 4.2.0'
s.add_dependency 'multi_json', '>= 1.2'

s.files = `git ls-files`.split("\n")
Expand Down
24 changes: 11 additions & 13 deletions test/jbuilder_template_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -439,21 +439,19 @@ def assert_collection_rendered(result, context = nil)
assert_equal "Chris Harris", result["name"]
end

if Rails::VERSION::MAJOR >= 4
test "renders partial via set! with same name as HTML partial" do
partials = {
"_blog_post.html.erb" => "Hello!",
"_blog_post.json.jbuilder" => BLOG_POST_PARTIAL
}
test "renders partial via set! with same name as HTML partial" do
partials = {
"_blog_post.html.erb" => "Hello!",
"_blog_post.json.jbuilder" => BLOG_POST_PARTIAL
}

@post = BLOG_POST_COLLECTION.first
@post = BLOG_POST_COLLECTION.first

result = jbuild(<<-JBUILDER, partials: partials)
json.post @post, partial: "blog_post", as: :blog_post
JBUILDER
result = jbuild(<<-JBUILDER, partials: partials)
json.post @post, partial: "blog_post", as: :blog_post
JBUILDER

assert_not_nil result["post"]
assert_equal 1, result["post"]["id"]
end
assert_not_nil result["post"]
assert_equal 1, result["post"]["id"]
end
end

0 comments on commit eb5d376

Please sign in to comment.