diff options
| author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-10 00:56:29 +0000 |
|---|---|---|
| committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-10 00:56:29 +0000 |
| commit | b001079cee3aca8387adeacaf33a78419e167a48 (patch) | |
| tree | be1b76d2fff4338824b31770e7737a41002fe1cf /lib/mini/mock.rb | |
| parent | 1ca5143193379d73a01c2ccdabe0d280cf73a47a (diff) | |
| download | ruby-b001079cee3aca8387adeacaf33a78419e167a48.tar.gz ruby-b001079cee3aca8387adeacaf33a78419e167a48.tar.xz ruby-b001079cee3aca8387adeacaf33a78419e167a48.zip | |
Removing miniunit
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mini/mock.rb')
| -rw-r--r-- | lib/mini/mock.rb | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/lib/mini/mock.rb b/lib/mini/mock.rb deleted file mode 100644 index 1b79146cb..000000000 --- a/lib/mini/mock.rb +++ /dev/null @@ -1,37 +0,0 @@ -############################################################ -# This file is imported from a different project. -# DO NOT make modifications in this repo. -# File a patch instead and assign it to Ryan Davis -############################################################ - -class MockExpectationError < StandardError; end - -require 'mini/test' - -class Mini::Mock - def initialize - @expected_calls = {} - @actual_calls = Hash.new {|h,k| h[k] = [] } - end - - def expect(name, retval, args=[]) - n, r, a = name, retval, args # for the closure below - @expected_calls[name] = { :retval => retval, :args => args } - self.class.__send__(:define_method, name) { |*x| - raise ArgumentError unless @expected_calls[n][:args].size == x.size - @actual_calls[n] << { :retval => r, :args => x } - retval - } - self - end - - def verify - @expected_calls.each_key do |name| - expected = @expected_calls[name] - msg = "expected #{name}, #{expected.inspect}" - raise MockExpectationError, msg unless - @actual_calls.has_key? name and @actual_calls[name].include?(expected) - end - true - end -end |
