Skip to content

Commit d448481

Browse files
committed
Merge pull request #1386 from bf4/warnings_fix_again
Remove capture_warnings testing. Is fickle and Rubocop linting is good enough
2 parents dde843d + e3b9597 commit d448481

File tree

6 files changed

+41
-110
lines changed

6 files changed

+41
-110
lines changed

.rubocop.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,29 @@ Style/MultilineOperationIndentation:
5858
Style/BlockDelimiters:
5959
Enabled: true
6060
EnforcedStyle: line_count_based
61+
62+
########## test_helper.rb sanity
63+
Style/EndBlock:
64+
Exclude:
65+
- test/test_helper.rb
66+
67+
Style/SpecialGlobalVars:
68+
Exclude:
69+
- test/test_helper.rb
70+
71+
Style/GlobalVars:
72+
Exclude:
73+
- test/test_helper.rb
74+
75+
Style/AndOr:
76+
Exclude:
77+
- test/test_helper.rb
78+
- 'lib/active_model/serializer/lint.rb'
79+
80+
Style/Not:
81+
Exclude:
82+
- test/test_helper.rb
83+
84+
Style/ClassCheck:
85+
Exclude:
86+
- test/test_helper.rb

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ Style/AlignHash:
5353
Exclude:
5454
- 'test/action_controller/json_api/pagination_test.rb'
5555

56-
# Offense count: 1
57-
# Cop supports --auto-correct.
58-
# Configuration parameters: EnforcedStyle, SupportedStyles.
59-
Style/AndOr:
60-
Exclude:
61-
- 'lib/active_model/serializer/lint.rb'
62-
6356
# Offense count: 25
6457
# Cop supports --auto-correct.
6558
# Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -105,7 +98,6 @@ Style/EachWithObject:
10598
Style/GuardClause:
10699
Exclude:
107100
- 'lib/active_model/serializer.rb'
108-
- 'test/capture_warnings.rb'
109101

110102
# Offense count: 12
111103
# Cop supports --auto-correct.

.simplecov

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ SimpleCov.profiles.define 'app' do
4141
add_filter '/config/'
4242
add_filter '/db/'
4343
add_filter 'tasks'
44+
add_filter '/.bundle/'
4445
end
4546

4647
## START TRACKING COVERAGE (before activating SimpleCov)

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cache:
1616
- vendor/bundle
1717

1818
script:
19-
- env CAPTURE_STDERR=${CAPTURE_STDERR:-false} bundle exec rake ci
19+
- bundle exec rake ci
2020

2121
env:
2222
- "RAILS_VERSION=4.0"
@@ -31,8 +31,6 @@ matrix:
3131
- rvm: 2.1
3232
env: RAILS_VERSION=master
3333
include:
34-
- rvm: 2.2
35-
env: CAPTURE_STDERR=true
3634
- rvm: jruby-9.0.4.0
3735
env: JRUBY_OPTS='-Xcompat.version=2.0 --server -Xcompile.invokedynamic=false -Xcli.debug=true --debug'
3836
allow_failures:

test/capture_warnings.rb

Lines changed: 0 additions & 75 deletions
This file was deleted.

test/test_helper.rb

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,26 @@
2121
FileUtils.mkdir_p(File.expand_path('../../tmp/cache', __FILE__))
2222

2323
gem 'minitest'
24-
require 'minitest/autorun'
25-
require 'minitest/reporters'
26-
Minitest::Reporters.use!
27-
if defined?(Minitest::Test)
28-
$minitest_version = 5 # rubocop:disable Style/GlobalVars
29-
# Minitest 5
30-
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest/autorun.rb
31-
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest.rb#L45-L59
32-
else
33-
$minitest_version = 4 # rubocop:disable Style/GlobalVars
24+
begin
25+
require 'minitest'
26+
rescue LoadError
3427
# Minitest 4
28+
require 'minitest/autorun'
29+
$minitest_version = 4
3530
# https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/autorun.rb
3631
# https://github.com/seattlerb/minitest/blob/644a52fd0/lib/minitest/unit.rb#L768-L787
3732
# Ensure backward compatibility with Minitest 4
3833
Minitest = MiniTest unless defined?(Minitest)
3934
Minitest::Test = MiniTest::Unit::TestCase
40-
def Minitest.after_run(&block)
41-
MiniTest::Unit.after_tests(&block)
42-
end
43-
end
44-
45-
# If there's no failure info, try disabling capturing stderr:
46-
# `env CAPTURE_STDERR=false rake`
47-
# This is way easier than writing a Minitest plugin
48-
# for 4.x and 5.x.
49-
if ENV['CAPTURE_STDERR'] !~ /false|1/i
50-
require 'capture_warnings'
51-
CaptureWarnings.new(_fail_build = true).execute!
5235
else
53-
$VERBOSE = true
36+
# Minitest 5
37+
require 'minitest/autorun'
38+
$minitest_version = 5
39+
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest/autorun.rb
40+
# https://github.com/seattlerb/minitest/blob/e21fdda9d/lib/minitest.rb#L45-L59
5441
end
42+
require 'minitest/reporters'
43+
Minitest::Reporters.use!
5544

5645
require 'active_model_serializers'
5746
require 'active_model/serializer/railtie'
@@ -71,6 +60,6 @@ def Minitest.after_run(&block)
7160
require 'fixtures/poro'
7261

7362
ActiveSupport.on_load(:active_model_serializers) do
74-
$action_controller_logger = ActiveModelSerializers.logger # rubocop:disable Style/GlobalVars
63+
$action_controller_logger = ActiveModelSerializers.logger
7564
ActiveModelSerializers.logger = Logger.new(IO::NULL)
7665
end

0 commit comments

Comments
 (0)