diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-28 11:40:23 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-12-28 11:40:23 -0800 |
commit | 4691cc43ee184414e2366340c3227e6fdf2aba7d (patch) | |
tree | 3e054b5e8c0c5f04222f5e2068540a020de36c18 /railties/test/initializer | |
parent | 632df063a33fab68b50ed893630af7f38821878d (diff) | |
download | rails-4691cc43ee184414e2366340c3227e6fdf2aba7d.tar.gz rails-4691cc43ee184414e2366340c3227e6fdf2aba7d.tar.bz2 rails-4691cc43ee184414e2366340c3227e6fdf2aba7d.zip |
Fix ruby version test
Diffstat (limited to 'railties/test/initializer')
-rw-r--r-- | railties/test/initializer/check_ruby_version_test.rb | 49 |
1 files changed, 9 insertions, 40 deletions
diff --git a/railties/test/initializer/check_ruby_version_test.rb b/railties/test/initializer/check_ruby_version_test.rb index 0691caad9d..a2c07ece75 100644 --- a/railties/test/initializer/check_ruby_version_test.rb +++ b/railties/test/initializer/check_ruby_version_test.rb @@ -1,7 +1,7 @@ require "isolation/abstract_unit" module InitializerTests - class PathsTest < Test::Unit::TestCase + class CheckRubyVersionTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation def setup @@ -9,52 +9,21 @@ module InitializerTests boot_rails end - test "rails does not initialize with ruby version 1.8.1" do - assert_rails_does_not_boot "1.8.1" - end - - test "rails does not initialize with ruby version 1.8.2" do - assert_rails_does_not_boot "1.8.2" - end - - test "rails does not initialize with ruby version 1.8.3" do - assert_rails_does_not_boot "1.8.3" - end - - test "rails does not initialize with ruby version 1.8.4" do - assert_rails_does_not_boot "1.8.4" - end - - test "rails does not initializes with ruby version 1.8.5" do - assert_rails_does_not_boot "1.8.5" - end - - test "rails does not initialize with ruby version 1.8.6" do - assert_rails_does_not_boot "1.8.6" - end - - test "rails initializes with ruby version 1.8.7" do - assert_rails_boots "1.8.7" - end - - test "rails initializes with the current version of Ruby" do - assert_rails_boots - end - - def set_ruby_version(version) - $-w = nil - Object.const_set(:RUBY_VERSION, version.freeze) + test "rails initializes with ruby 1.8.7 or later" do + if RUBY_VERSION < '1.8.7' + assert_rails_does_not_boot + else + assert_rails_boots + end end - def assert_rails_boots(version = nil) - set_ruby_version(version) if version + def assert_rails_boots assert_nothing_raised "It appears that rails does not boot" do require "rails" end end - def assert_rails_does_not_boot(version) - set_ruby_version(version) + def assert_rails_does_not_boot $stderr = File.open("/dev/null", "w") assert_raises(SystemExit) do require "rails" |