Funky Mock

Simple mock implementation to run on DaFunk ecosystem. Copied from mruby-mock.

Usage

# 1. Creating mock
mock = FunkyMock::Mock.new
mock.stubs(:code).returns("200")
mock.stubs(:body).returns("success")
mock.code
# => "200"
mock.body
# => "success"

# 2. Stubing methods
class B
  def code
    "300"
  end
end

b = B.new
b.stubs(:code).returns("200")

b.code
# => "200"

class A
  def self.a
    false
  end
end

A.stubs(:a).returns(true)
A.a
# => true

Setup

bundle install
bundle exec rake # compiling
bundle exec test # testing

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

This project is released under the MIT License.