D
Drew Olson
I've got a rake TestTask that I have set a global variable in specific
cases (I know, I know, tsk tsk). However, this value doesn't seem to be
available to my tests. This seems very strange to me. The variable
should be global, right? Below is a simple example. The test case fails
as the value of $test is nil and I have no idea why.
My rakefile.rb is:
require 'rake/testtask'
Rake::TestTask.new do |t|
$test = "this is a test"
t.test_files = FileList["my_test.rb"]
end
My test case my_test.rb is:
require 'test/unit'
class MyTest < Test::Unit::TestCase
def test_global_variable
assert_equal "this is a test", $test
end
end
Any idea why this doesn't work?
Thanks,
Drew
cases (I know, I know, tsk tsk). However, this value doesn't seem to be
available to my tests. This seems very strange to me. The variable
should be global, right? Below is a simple example. The test case fails
as the value of $test is nil and I have no idea why.
My rakefile.rb is:
require 'rake/testtask'
Rake::TestTask.new do |t|
$test = "this is a test"
t.test_files = FileList["my_test.rb"]
end
My test case my_test.rb is:
require 'test/unit'
class MyTest < Test::Unit::TestCase
def test_global_variable
assert_equal "this is a test", $test
end
end
Any idea why this doesn't work?
Thanks,
Drew