Forked from lunich/deprecate_assertions.rb
Last active
December 10, 2015 00:48
Revisions
-
e1senh0rn revised this gist
Dec 21, 2012 . 2 changed files with 8 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ module DeprecateAssertions def self.methods_to_replace [ :assert, @@ -18,7 +18,7 @@ def self.methods_to_replace :assert_nil, ] end def self.included a a.class_eval do DeprecateAssertions.methods_to_replace.each do |m| @@ -27,23 +27,13 @@ def self.included a end end end DeprecateAssertions.methods_to_replace.each do |m| define_method(:"new_#{m}") do |*args| warn "[DEPRECATED] '#{m}' is deprecated. Please use RSpec methods instead." warn "from: #{caller[0]}" send(:"old_#{m}", *args) end end end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ RSpec.configure do |config| config.include DeprecateAssertions # ... end -
e1senh0rn revised this gist
Dec 21, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,9 @@ def self.methods_to_replace :assert_not_same, :assert_raise, :assert_respond_to, :assert_difference, :assert_in_delta, :assert_nil, ] end public -
lunich created this gist
Dec 19, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ module DeprecateAssertions protected def self.methods_to_replace [ :assert, :assert_block, :assert_equal, :assert_no_match, :assert_not_equal, :assert_nothing_raised, :assert_nothing_thrown, :assert_not_nil, :assert_not_same, :assert_raise, :assert_respond_to, ] end public def self.included a a.class_eval do DeprecateAssertions.methods_to_replace.each do |m| alias :"old_#{m}" :"#{m}" alias :"#{m}" :"new_#{m}" end end end DeprecateAssertions.methods_to_replace.each do |m| define_method(:"new_#{m}") do |*args| warn "[DEPRECATED] '#{m}' is deprecated. Please use RSpec methods instead." warn "from: #{caller[0]}" send(:"old_#{m}", *args) end end end require "test/unit" Test::Unit::Assertions.class_eval do include DeprecateAssertions end class TestMe < Test::Unit::TestCase def test_me assert_equal 12, 3 * 4 end end