Module: Spec::Mocks::Methods

Included in:
Object, Mock
Defined in:
lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb

Instance Method Summary collapse

Instance Method Details

#as_null_objectObject



32
33
34
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 32

def as_null_object
  __mock_proxy.as_null_object
end

#null_object?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 36

def null_object?
  __mock_proxy.null_object?
end

#received_message?(sym, *args, &block) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


20
21
22
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 20

def received_message?(sym, *args, &block) #:nodoc:
  __mock_proxy.received_message?(sym.to_sym, *args, &block)
end

#rspec_resetObject

:nodoc:



28
29
30
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 28

def rspec_reset #:nodoc:
  __mock_proxy.reset
end

#rspec_verifyObject

:nodoc:



24
25
26
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 24

def rspec_verify #:nodoc:
  __mock_proxy.verify
end

#should_not_receive(sym, &block) ⇒ Object



8
9
10
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 8

def should_not_receive(sym, &block)
  __mock_proxy.add_negative_message_expectation(caller(1)[0], sym.to_sym, &block)
end

#should_receive(sym, opts = {}, &block) ⇒ Object



4
5
6
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 4

def should_receive(sym, opts={}, &block)
  __mock_proxy.add_message_expectation(opts[:expected_from] || caller(1)[0], sym.to_sym, opts, &block)
end

#stub!(sym_or_hash, opts = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/gems/rspec-1.1.12/lib/spec/mocks/methods.rb', line 12

def stub!(sym_or_hash, opts={})
  if Hash === sym_or_hash
    sym_or_hash.each {|method, value| stub!(method).and_return value }
  else
    __mock_proxy.add_stub(caller(1)[0], sym_or_hash.to_sym, opts)
  end
end