module Kernel

Public Instance Methods

mock(method, options = {}, &block) click to toggle source

Create a pure mock object rather than mocking specific methods on an object.

Examples

my_mock = mock(:thing, :return => "whee!")
my_mock.thing    # => "whee"
# File lib/motion-spec/mock/mock.rb, line 57
def mock(method, options = {}, &block)
  mock_object = Object.new
  mock_object.mock!(method, options, &block)
  mock_object
end
print(*args) click to toggle source
puts(*args) click to toggle source
# File lib/motion-spec.rb, line 56
def puts(*args)
  NSLog(args.join("\n"))
end
stub(method, options = {}, &block) click to toggle source

Create a pure stub object.

Examples

stubbalicious = stub(:failure, "wat u say?")
stubbalicious.failure     # => "wat u say?"
# File lib/motion-spec/mock/stub.rb, line 30
def stub(method, options = {}, &block)
  stub_object = Object.new
  stub_object.stub!(method, options, &block)

  stub_object
end

Private Instance Methods

context(*args, &block)
Alias for: describe
describe(*args, &block) click to toggle source
# File lib/motion-spec/extensions/kernel.rb, line 4
def describe(*args, &block)
  MotionSpec::Context.new(args.join(' '), &block)
end
Also aliased as: context
shared(name, &block) click to toggle source
# File lib/motion-spec/extensions/kernel.rb, line 9
def shared(name, &block)
  MotionSpec::Shared[name] = block
end