Skip to content

Commit

Permalink
Add the Collector class to do inverse expectations.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manfred committed May 12, 2009
1 parent 723c5de commit d4b2a96
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Flush/test/ext/collector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Collector
attr_accessor :_messages

def initialize(*methods)
(class << self; self; end).class_eval do
methods.each do |m|
define_method m do |*args|
self._messages << [m, args]
end
end
end
self._messages = []
end

def received?(m)
self._messages.any? { |method, _| method == m }
end
end

0 comments on commit d4b2a96

Please sign in to comment.