Skip to content

Commit

Permalink
Emit warnings generated during test runs
Browse files Browse the repository at this point in the history
If a warning is emitted during a test run, the test run will fail. This
means that we have to fix warnings that the gem generates before passing
CI.
  • Loading branch information
mcmire committed Jan 16, 2020
1 parent dd8c73c commit 2aa0180
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gemspec

gem "minitest"
gem "test-unit"
gem "warnings_logger"
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ GEM
power_assert
thor (0.20.3)
unicode-display_width (1.4.1)
warnings_logger (0.1.0)

PLATFORMS
ruby
Expand All @@ -65,6 +66,7 @@ DEPENDENCIES
shoulda-context!
snowglobe (>= 0.3.0)
test-unit
warnings_logger

BUNDLED WITH
1.17.3
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Rake::TestTask.new do |t|
t.libs << "test"
t.ruby_opts += ["-w"]
t.pattern = "test/**/*_test.rb"
t.verbose = false
t.verbose = true
end

task :default do
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_4_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "https://rubygems.org"

gem "minitest"
gem "test-unit"
gem "warnings_logger"
gem "sqlite3", "~> 1.3.6"
gem "rails", "~> 4.2.0"

Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails_4_2.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ GEM
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
warnings_logger (0.1.0)

PLATFORMS
ruby
Expand All @@ -157,6 +158,7 @@ DEPENDENCIES
snowglobe (>= 0.3.0)
sqlite3 (~> 1.3.6)
test-unit
warnings_logger

BUNDLED WITH
1.17.3
1 change: 1 addition & 0 deletions gemfiles/rails_5_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "https://rubygems.org"

gem "minitest"
gem "test-unit"
gem "warnings_logger"
gem "sqlite3", "~> 1.3.6"
gem "rails", "~> 5.0.0"

Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails_5_0.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ GEM
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
warnings_logger (0.1.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand All @@ -163,6 +164,7 @@ DEPENDENCIES
snowglobe (>= 0.3.0)
sqlite3 (~> 1.3.6)
test-unit
warnings_logger

BUNDLED WITH
1.17.3
1 change: 1 addition & 0 deletions gemfiles/rails_5_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "https://rubygems.org"

gem "minitest"
gem "test-unit"
gem "warnings_logger"
gem "sqlite3", "~> 1.3.6"
gem "rails", "~> 5.1.0"

Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails_5_1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ GEM
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
warnings_logger (0.1.0)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand All @@ -163,6 +164,7 @@ DEPENDENCIES
snowglobe (>= 0.3.0)
sqlite3 (~> 1.3.6)
test-unit
warnings_logger

BUNDLED WITH
1.17.3
1 change: 1 addition & 0 deletions gemfiles/rails_5_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source "https://rubygems.org"

gem "minitest"
gem "test-unit"
gem "warnings_logger"
gem "sqlite3", "~> 1.3.6"
gem "rails", "~> 5.2.0"

Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails_5_2.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ GEM
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
warnings_logger (0.1.0)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand All @@ -171,6 +172,7 @@ DEPENDENCIES
snowglobe (>= 0.3.0)
sqlite3 (~> 1.3.6)
test-unit
warnings_logger

BUNDLED WITH
1.17.3
14 changes: 11 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#---

require "pry-byebug"
require "warnings_logger"

TEST_FRAMEWORK = ENV.fetch("TEST_FRAMEWORK", "minitest")

if TEST_FRAMEWORK == "test_unit"
Expand All @@ -14,8 +17,6 @@
require "mocha/minitest"
end

require "pry-byebug"

PROJECT_DIR = File.expand_path("../..", __FILE__)
PARENT_TEST_CASE =
if TEST_FRAMEWORK == "test_unit"
Expand All @@ -30,11 +31,18 @@
Minitest::Assertion
end

WarningsLogger::Spy.call(
project_name: "shoulda-context",
project_directory: Pathname.new("../..").expand_path(__FILE__)
)

require_relative "support/rails_application_with_shoulda_context"

require_relative "../lib/shoulda/context"

Shoulda.autoload_macros(
File.join(File.dirname(__FILE__), "fake_rails_root"),
File.join("vendor", "{plugins,gems}", "*")
)

require_relative "support/rails_application_with_shoulda_context"
$VERBOSE = true

0 comments on commit 2aa0180

Please sign in to comment.