Skip to content

Commit 89e0a39

Browse files
committed
Drop support for Rails 4.0 and Ruby 2.0.0
1 parent 0e82f6b commit 89e0a39

File tree

7 files changed

+20
-68
lines changed

7 files changed

+20
-68
lines changed

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: ruby
33
sudo: false
44

55
rvm:
6-
- 2.0.0
76
- 2.1
87
- 2.2.3
98
- 2.3.0
@@ -26,25 +25,18 @@ env:
2625
global:
2726
- "JRUBY_OPTS='--dev -J-Xmx1024M --debug'"
2827
matrix:
29-
- "RAILS_VERSION=4.0"
3028
- "RAILS_VERSION=4.1"
3129
- "RAILS_VERSION=4.2"
3230
- "RAILS_VERSION=master"
3331

3432
matrix:
3533
exclude:
36-
- rvm: 2.0.0
37-
env: RAILS_VERSION=master
3834
- rvm: 2.1
3935
env: RAILS_VERSION=master
4036
- rvm: jruby-9.0.4.0
4137
env: RAILS_VERSION=master
42-
- rvm: jruby-9.0.4.0
43-
env: RAILS_VERSION=4.0
4438
- rvm: jruby-head
4539
env: RAILS_VERSION=master
46-
- rvm: jruby-head
47-
env: RAILS_VERSION=4.0
4840
allow_failures:
4941
- rvm: ruby-head
5042
- rvm: jruby-head

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ end
4444
group :test do
4545
gem 'sqlite3', platform: (@windows_platforms + [:ruby])
4646
gem 'activerecord-jdbcsqlite3-adapter', platform: :jruby
47-
4847
gem 'codeclimate-test-reporter', require: false
4948
end
5049

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ skip_tags: true
44

55
environment:
66
matrix:
7-
- ruby_version: "200"
8-
- ruby_version: "200-x64"
97
- ruby_version: "21"
108
- ruby_version: "21-x64"
119
- ruby_version: "jruby-9.0.4.0"

lib/active_model/serializer/lint.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,17 @@ def test_to_json
7676
resource.to_json(nil)
7777
end
7878

79-
# Passes if the object responds to <tt>cache_key</tt> and if it takes no
80-
# arguments (Rails 4.0) or a splat (Rails 4.1+).
79+
# Passes if the object responds to <tt>cache_key</tt>
8180
# Fails otherwise.
8281
#
83-
# <tt>cache_key</tt> returns a (self-expiring) unique key for the object, and
84-
# is part of the (self-expiring) cache_key, which is used by the adapter.
85-
# It is not required unless caching is enabled.
82+
# <tt>cache_key</tt> returns a (self-expiring) unique key for the object,
83+
# and is part of the (self-expiring) cache_key, which is used by the
84+
# adapter. It is not required unless caching is enabled.
8685
def test_cache_key
8786
assert_respond_to resource, :cache_key
8887
actual_arity = resource.method(:cache_key).arity
89-
# using absolute value since arity is:
90-
# 0 for Rails 4.1+, *timestamp_names
91-
# -1 for Rails 4.0, no arguments
92-
assert_includes [-1, 0], actual_arity, "expected #{actual_arity.inspect} to be 0 or -1"
88+
assert_includes [-1, 0], actual_arity,
89+
"expected #{actual_arity.inspect} to be 0 or -1"
9390
end
9491

9592
# Passes if the object responds to <tt>updated_at</tt> and if it takes no

test/active_model_serializers/test/serializer_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ def render_using_serializer
1010
render json: Profile.new(name: 'Name 1', description: 'Description 1', comments: 'Comments 1')
1111
end
1212

13-
# For Rails4.0
1413
def render_some_text
15-
Rails.version > '4.1' ? render(plain: 'ok') : render(text: 'ok')
14+
render(plain: 'ok')
1615
end
1716
end
1817

test/array_serializer_test.rb

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,19 @@
33

44
module ActiveModel
55
class Serializer
6-
# Minitest.run_one_method isn't present in minitest 4
7-
if $minitest_version > 4 # rubocop:disable Style/GlobalVars
8-
class ArraySerializerTest < CollectionSerializerTest
9-
extend Minitest::Assertions
10-
def self.run_one_method(*)
11-
_, stderr = capture_io do
12-
super
13-
end
14-
if stderr !~ /NOTE: ActiveModel::Serializer::ArraySerializer.new is deprecated/
15-
fail Minitest::Assertion, stderr
16-
end
6+
class ArraySerializerTest < CollectionSerializerTest
7+
extend Minitest::Assertions
8+
def self.run_one_method(*)
9+
_, stderr = capture_io do
10+
super
1711
end
18-
19-
def collection_serializer
20-
ArraySerializer
12+
if stderr !~ /NOTE: ActiveModel::Serializer::ArraySerializer.new is deprecated/
13+
fail Minitest::Assertion, stderr
2114
end
2215
end
23-
else
24-
class ArraySerializerTest < ActiveSupport::TestCase
25-
def test_json_key_with_root_warns_when_using_array_serializer
26-
_, stderr = capture_io do
27-
comment = Comment.new
28-
post = Post.new
29-
serializer = ArraySerializer.new([comment, post])
30-
assert_equal 'comments', serializer.json_key
31-
end
32-
assert_match(/NOTE: ActiveModel::Serializer::ArraySerializer.new is deprecated/, stderr)
33-
end
16+
17+
def collection_serializer
18+
ArraySerializer
3419
end
3520
end
3621
end

test/test_helper.rb

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,9 @@
2020
FileUtils.mkdir_p(File.expand_path('../../tmp/cache', __FILE__))
2121

2222
gem 'minitest'
23-
begin
24-
require 'minitest'
25-
rescue LoadError
26-
# Minitest 4
27-
require 'minitest/autorun'
28-
$minitest_version = 4
29-
# https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/autorun.rb
30-
# https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/unit.rb#L768-L787
31-
# Ensure backward compatibility with Minitest 4
32-
Minitest = MiniTest unless defined?(Minitest)
33-
Minitest::Test = MiniTest::Unit::TestCase
34-
else
35-
# Minitest 5
36-
require 'minitest/autorun'
37-
$minitest_version = 5
38-
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest/autorun.rb
39-
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest.rb#L45-L59
40-
# Filter out Minitest backtrace while allowing backtrace from other libraries
41-
# to be shown.
42-
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
43-
end
23+
require 'minitest'
24+
require 'minitest/autorun'
25+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
4426

4527
require 'support/rails_app'
4628

0 commit comments

Comments
 (0)