Skip to content

Commit b697aa4

Browse files
committed
Remove warnings
When running tests locally, multiple warnings were being emitted. A lot of these warnings have to do with the fact that we are overriding core methods in RSpec, and whenever you override a method, Ruby feels the need to inform you. To get around this, we need to use the same trick that we already use for AugmentedMatcher: we create a module on the fly and `prepend` it to the class or module in question. Sometimes we might even need to `prepend` to the singleton class. Also, this commit adds WarningsLogger so that we can track when this happens again.
1 parent a0aef2e commit b697aa4

25 files changed

+396
-304
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ gem "pry-byebug", platform: :mri
1010
gem "pry-nav", platform: :jruby
1111
gem "rake"
1212
gem "rubocop"
13+
gem "warnings_logger"
1314

1415
gemspec

Rakefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ require_relative "support/current_bundle"
44

55
begin
66
require "rspec/core/rake_task"
7-
RSpec::Core::RakeTask.new(:spec)
7+
RSpec::Core::RakeTask.new(spec: :before_spec) do |config|
8+
config.verbose = true
9+
end
810
rescue LoadError
911
task :spec do
1012
appraisal = SuperDiff::CurrentBundle.instance.latest_appraisal
@@ -22,3 +24,7 @@ task :default do
2224
exec "appraisal install && appraisal #{appraisal.name} rake --trace"
2325
end
2426
end
27+
28+
task :before_spec do
29+
FileUtils.rm_rf(File.expand_path("./spec/tmp", __dir__))
30+
end

gemfiles/no_rails_rspec_gte_3_10.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem "pry-byebug", platform: :mri
88
gem "pry-nav", platform: :jruby
99
gem "rake"
1010
gem "rubocop"
11+
gem "warnings_logger"
1112
gem "rspec", ">= 3.10", "< 4"
1213

1314
gemspec path: "../"

gemfiles/no_rails_rspec_gte_3_10.gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ GEM
6363
thor (1.0.1)
6464
trollop (1.16.2)
6565
unicode-display_width (1.7.0)
66+
warnings_logger (0.1.1)
6667

6768
PLATFORMS
6869
ruby
@@ -76,6 +77,7 @@ DEPENDENCIES
7677
rspec (>= 3.10, < 4)
7778
rubocop
7879
super_diff!
80+
warnings_logger
7981

8082
BUNDLED WITH
8183
2.1.4

gemfiles/no_rails_rspec_lt_3_10.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem "pry-byebug", platform: :mri
88
gem "pry-nav", platform: :jruby
99
gem "rake"
1010
gem "rubocop"
11+
gem "warnings_logger"
1112
gem "rspec", "< 3.10"
1213

1314
gemspec path: "../"

gemfiles/no_rails_rspec_lt_3_10.gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ GEM
6363
thor (1.0.1)
6464
trollop (1.16.2)
6565
unicode-display_width (1.7.0)
66+
warnings_logger (0.1.1)
6667

6768
PLATFORMS
6869
ruby
@@ -76,6 +77,7 @@ DEPENDENCIES
7677
rspec (< 3.10)
7778
rubocop
7879
super_diff!
80+
warnings_logger
7981

8082
BUNDLED WITH
8183
2.1.4

gemfiles/rails_5_0_rspec_gte_3_10.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem "pry-byebug", platform: :mri
88
gem "pry-nav", platform: :jruby
99
gem "rake"
1010
gem "rubocop"
11+
gem "warnings_logger"
1112
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
1213
gem "jdbc-sqlite3", platform: :jruby
1314
gem "activerecord", "~> 5.0.0"

gemfiles/rails_5_0_rspec_gte_3_10.gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ GEM
123123
tzinfo (1.2.7)
124124
thread_safe (~> 0.1)
125125
unicode-display_width (1.7.0)
126+
warnings_logger (0.1.1)
126127

127128
PLATFORMS
128129
ruby
@@ -145,6 +146,7 @@ DEPENDENCIES
145146
rubocop
146147
sqlite3 (~> 1.3.6)
147148
super_diff!
149+
warnings_logger
148150

149151
BUNDLED WITH
150152
2.1.4

gemfiles/rails_5_0_rspec_lt_3_10.gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem "pry-byebug", platform: :mri
88
gem "pry-nav", platform: :jruby
99
gem "rake"
1010
gem "rubocop"
11+
gem "warnings_logger"
1112
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
1213
gem "jdbc-sqlite3", platform: :jruby
1314
gem "activerecord", "~> 5.0.0"

gemfiles/rails_5_0_rspec_lt_3_10.gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ GEM
123123
tzinfo (1.2.7)
124124
thread_safe (~> 0.1)
125125
unicode-display_width (1.7.0)
126+
warnings_logger (0.1.1)
126127

127128
PLATFORMS
128129
ruby
@@ -145,6 +146,7 @@ DEPENDENCIES
145146
rubocop
146147
sqlite3 (~> 1.3.6)
147148
super_diff!
149+
warnings_logger
148150

149151
BUNDLED WITH
150152
2.1.4

0 commit comments

Comments
 (0)