diff options
| author | Mike McQuaid | 2017-07-07 09:43:39 +0100 | 
|---|---|---|
| committer | GitHub | 2017-07-07 09:43:39 +0100 | 
| commit | 7aaa7e1b79ca7613c74e4189b38eeee94740cc57 (patch) | |
| tree | 0c3d19bf7ee699fc63b4b59f7501946dda320b64 /Library/Homebrew/formula_assertions.rb | |
| parent | 5b464babf8982acbb6e6d193c9b6016820c69b9b (diff) | |
| download | brew-7aaa7e1b79ca7613c74e4189b38eeee94740cc57.tar.bz2 | |
formula_assertions: make removable on Ruby 2.0.
Diffstat (limited to 'Library/Homebrew/formula_assertions.rb')
| -rw-r--r-- | Library/Homebrew/formula_assertions.rb | 14 | 
1 files changed, 3 insertions, 11 deletions
| diff --git a/Library/Homebrew/formula_assertions.rb b/Library/Homebrew/formula_assertions.rb index 49198cf43..2ba5767a7 100644 --- a/Library/Homebrew/formula_assertions.rb +++ b/Library/Homebrew/formula_assertions.rb @@ -3,17 +3,9 @@ module Homebrew      require "test/unit/assertions"      include ::Test::Unit::Assertions -    # Custom name here for cross-version compatibility. -    # In Ruby 2.0, Test::Unit::Assertions raise a MiniTest::Assertion, -    # but they raise Test::Unit::AssertionFailedError in 2.3. -    # If neither is defined, this might be a completely different -    # version of Ruby. -    if defined?(MiniTest::Assertion) -      AssertionFailed = MiniTest::Assertion -    elsif defined?(Test::Unit::AssertionFailedError) -      AssertionFailed = Test::Unit::AssertionFailedError -    else -      raise NameError, "Unable to find an assertion class for this version of Ruby (#{RUBY_VERSION})" +    # TODO: remove this when we no longer support Ruby 2.0. +    unless defined?(Test::Unit::AssertionFailedError) +      Test::Unit::AssertionFailedError = MiniTest::Assertion      end      # Returns the output of running cmd, and asserts the exit status | 
