Created
April 10, 2018 04:58
-
-
Save kaorukobo/32509cd22b98cf99796e932565a7766e to your computer and use it in GitHub Desktop.
This file contains 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 "minitest/autorun" | |
module HasConstant | |
CONST = "const" | |
end | |
# ================================================ | |
# Pass: | |
class TheTest1 < Minitest::Test | |
include HasConstant | |
def test_it | |
CONST | |
end | |
end | |
# ================================================ | |
# Fail with the following message: | |
# Sample#test_0001_anonymous: | |
# NameError: uninitialized constant TheTest2::CONST | |
class TheTest2 < Minitest::Test | |
describe "Sample" do | |
include HasConstant | |
it do | |
CONST | |
end | |
end | |
end | |
# ================================================ | |
# Pass | |
class TheTest3 < Minitest::Test | |
include HasConstant | |
describe "Sample" do | |
it do | |
CONST | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment