Skip to content
A tiny mocking framework for Ruby
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.drone.yml
.kick
COPYING
README.md
bendy.rb
bendy_test.rb

README.md

Bendy

Bendy is a tiny mocking framework.

Install

$ curl -o lib/bendy.rb https://raw.github.com/Manfred/Bendy/master/bendy.rb

Examples

Basic mock implementation which responds to methods.

henry = shape(:name => "Henry")
henry.name #=> "Henry"

Mock implementation of a number of methods.

class Weblog
  def author
    "Henry"
  end

  def path
    "/path/to/weblog"
  end
end

weblog = shape(Weblog,
  :path => "/mnt/data/weblog",
  :reverse => Proc.new { |s| s.reverse }
)
weblog.path #=> "/mnt/data/weblog"
weblog.author #=> "Henry"
weblog.reverse('Jimmy') #=> 'ymmiJ"

Finally you can also pass arguments to the initializer.

class Weblog
  attr_reader :path

  def initialize(path)
    @path = path
  end
end

weblog = shape(Weblog, "/mnt/data/weblog", :author => "Henry")
weblog.path #=> "/mnt/data/weblog"
weblog.author #=> "Henry"

Copying

Bendy is freely distributable under the terms of an MIT-style license. See COPYING or http://www.opensource.org/licenses/mit-license.php.


“Ik wil alleen maar benden.”

Something went wrong with that request. Please try again.