Skip to content

Commit a36a8dc

Browse files
committed
clean up warnings
1 parent ab564d5 commit a36a8dc

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
bundle exec appraisal rails-${{ matrix.rails_version }} bundle --quiet
5959
MEASURE_COVERAGE=true bundle exec appraisal rails-${{ matrix.rails_version }} rake all_tests
6060
env:
61-
RAISE_ON_WARNING: 1
6261
RAILS_VERSION: ${{ matrix.rails_version }}
6362
RUBY_VERSION: ${{ matrix.ruby_version }}
6463
- name: Upload coverage results

spec/spec_helper.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66

77
require "bundler/setup"
88

9+
module Warning
10+
PROJECT_ROOT = File.expand_path("..", __dir__).freeze
11+
12+
def self.warn(message)
13+
called_by = caller_locations(1, 1).first.path
14+
return super unless called_by&.start_with?(PROJECT_ROOT) && !called_by.start_with?("#{PROJECT_ROOT}/vendor")
15+
return if message.include?("Template format for")
16+
17+
raise "Warning: #{message}"
18+
end
19+
end
20+
921
# Configure Rails Environment
1022
ENV["RAILS_ENV"] = "test"
1123

test/test_helper.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@
77
require "minitest/autorun"
88
require "minitest/mock"
99

10-
if ENV["RAISE_ON_WARNING"]
11-
module Warning
12-
PROJECT_ROOT = File.expand_path("..", __dir__).freeze
10+
module Warning
11+
PROJECT_ROOT = File.expand_path("..", __dir__).freeze
1312

14-
def self.warn(message)
15-
called_by = caller_locations(1, 1).first.path
16-
return super unless called_by&.start_with?(PROJECT_ROOT) && !called_by.start_with?("#{PROJECT_ROOT}/vendor")
17-
return super if message.include?("Template format for")
13+
def self.warn(message)
14+
called_by = caller_locations(1, 1).first.path
15+
return super unless called_by&.start_with?(PROJECT_ROOT) && !called_by.start_with?("#{PROJECT_ROOT}/vendor")
16+
return if message.include?("Template format for")
1817

19-
raise "Warning: #{message}"
20-
end
18+
raise "Warning: #{message}"
2119
end
2220
end
2321

0 commit comments

Comments
 (0)