From: Simon Chiang Date: 2009-01-30T00:13:15+09:00 Subject: MiniTest: a curious case of include (1.8 vs 1.9) I've been messing around with minitest and came across something very strange. Does anyone have an explanation for what is going on here? I think it must indicate subtle differences in blocks between 1.8 and 1.9. require 'rubygems' require 'minitest/spec' # # Including a module in a spec does not make constants # available under ruby 1.8 but it does under ruby 1.9. # # This script requires the minitest gem to be installed: # # % gem install minitest # module A module B end end # This passes on ruby 1.9, but not on 1.8. describe "MiniTest Includes" do include A it "should show inclusion works" do B.must_equal A::B end end # This passes on both. What's more, if you uncomment this # spec, the assignment TRANSLATES to the "MiniTest Includes" # spec and that spec will pass! # # describe "MiniTest Assigns" do # B = A::B # # it "should show assignment works" do # B.must_equal A::B # end # end # Here is an example showing the assignment case works. module X module Y end end describe "MiniTest Assigns X::Y" do Y = X::Y it "should show constant assignment works" do Y.must_equal X::Y end end MiniTest::Unit.autorun