Class: NilClass

Inherits:
Object show all
Defined in:
lib/hardmock/stubbing.rb

Instance Method Summary collapse

Instance Method Details

#expects!(mname, *args) ⇒ Object

Overridden to protect against accidental nil reference self delusion

Raises:

  • (StubbingError)


172
173
174
# File 'lib/hardmock/stubbing.rb', line 172

def expects!(mname, *args)
  raise StubbingError, "Cannot mock #{mname} method on nil.  (If you really mean to, try 'intentionally_expects!')"
end

#intentionally_expects!Object

Use this only if you really mean it



164
# File 'lib/hardmock/stubbing.rb', line 164

alias_method :intentionally_expects!, :expects!

#intentionally_stubs!Object

Use this only if you really mean it



161
# File 'lib/hardmock/stubbing.rb', line 161

alias_method :intentionally_stubs!, :stubs!

#stubs!(mname) ⇒ Object

Overridden to protect against accidental nil reference self delusion

Raises:

  • (StubbingError)


167
168
169
# File 'lib/hardmock/stubbing.rb', line 167

def stubs!(mname)
  raise StubbingError, "Cannot stub #{mname} method on nil.  (If you really mean to, try 'intentionally_stubs!')"
end