aboutsummaryrefslogblamecommitdiffstats
path: root/railties/test/application/initializers/check_ruby_version_test.rb
blob: 58782b25114a982cf9e9f9d3d6e8906d7c3aac7d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                 
 
                       
                                                   

                                             




                





                                                        

       
                          
                                                                    
                           


         
                                  

                                           
                           



         
require "isolation/abstract_unit"

module ApplicationTests
  class CheckRubyVersionTest < Test::Unit::TestCase
    include ActiveSupport::Testing::Isolation

    def setup
      build_app
      boot_rails
    end

    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
      assert_nothing_raised "It appears that rails does not boot" do
        require "rails/all"
      end
    end

    def assert_rails_does_not_boot
      $stderr = File.open("/dev/null", "w")
      assert_raises(SystemExit) do
        require "rails/all"
      end
    end
  end
end