Created
April 26, 2018 18:34
-
-
Save Edouard-chin/70705542a59a8593f619b02e1c0a188c to your computer and use it in GitHub Desktop.
Rails' SetupAndTeardown bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile(true) do | |
gem 'activesupport', github: 'rails/rails' | |
end | |
require 'active_support/all' | |
require 'minitest/autorun' | |
class BeforeSetupTest < ActiveSupport::TestCase | |
module MyLibrary | |
def before_setup | |
super | |
puts "before_setup called" | |
end | |
end | |
include MyLibrary | |
setup do | |
puts "Test#setup called" | |
end | |
test 'before_setup is called after setup' do | |
assert true | |
end | |
end | |
class AfterTeardownTest < ActiveSupport::TestCase | |
module MyLibrary | |
def after_teardown | |
super | |
puts "Will never get called" | |
end | |
end | |
include MyLibrary | |
teardown do | |
raise 'Teardown raises for any reason' | |
end | |
test 'after_teardown does not get called' do | |
assert true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment