]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/lib/spec/mocks/methods.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / lib / spec / mocks / methods.rb
1 module Spec
2   module Mocks
3     module Methods
4       def should_receive(sym, opts={}, &block)
5         __mock_proxy.add_message_expectation(opts[:expected_from] || caller(1)[0], sym.to_sym, opts, &block)
6       end
7
8       def should_not_receive(sym, &block)
9         __mock_proxy.add_negative_message_expectation(caller(1)[0], sym.to_sym, &block)
10       end
11       
12       def stub!(sym, opts={})
13         __mock_proxy.add_stub(caller(1)[0], sym.to_sym, opts)
14       end
15       
16       def received_message?(sym, *args, &block) #:nodoc:
17         __mock_proxy.received_message?(sym.to_sym, *args, &block)
18       end
19       
20       def rspec_verify #:nodoc:
21         __mock_proxy.verify
22       end
23
24       def rspec_reset #:nodoc:
25         __mock_proxy.reset
26       end
27
28     private
29
30       def __mock_proxy
31         if Mock === self
32           @mock_proxy ||= Proxy.new(self, @name, @options)
33         else
34           @mock_proxy ||= Proxy.new(self, self.class.name)
35         end
36       end
37     end
38   end
39 end