• Stars
    star
    359
  • Rank 118,537 (Top 3 %)
  • Language
    Ruby
  • License
    Other
  • Created over 12 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fake library for Ruby

Bogus

Bogus aims to make your unit tests more reliable by ensuring that you don't stub or mock methods that don't actually exist in the mocked objects.

build status Code Climate Coverage Status Gem Version Dependency Status githalytics.com alpha

Example

class PostRepository
  def store(title)
    # save a new post in the database
  end
end

class PostAdder < Struct.new(:post_repository)
  def add(title)
    post = post_repository.store(title)
    # do some stuff with the post
  end
end

require 'bogus/rspec'

describe PostAdder do
  fake(:post_repository)

  it "stores the post" do
    post_adder = PostAdder.new(post_repository)
    
    post_adder.add("Bogus is safe!")

    expect(post_repository).to have_received.store("Bogus is safe!")
  end
end

Features

  • Safe Stubbing - Bogus does not allow you to stub methods that don't exist or don't match the stubbed signature.
  • Fakes - test doubles that have the same interface as the doubled class.
  • Support for ActiveRecord models - Bogus comes with support for active record fields out of the box.
  • Global fake configuration - Decouple your fakes from class names and define default return values in one place.
  • Contract tests - a unique feature of Bogus, which reduces the need for integrated tests to a minimum by ensuring that the things you stub match how the object really behaves.

Documentation

You can find more detailed (and executable) documentation on Relish.

License

MIT. See the LICENSE file.

Authors

More Repositories

1

dependor

Simple Dependency Injection/Service Locator framework for Rails-like applications.
Ruby
109
star
2

js-test-driver-rails

A Rails warpper for easier integration of JS Test Driver
Ruby
16
star
3

dyplom

JavaScript
10
star
4

dotfiles

my configs
Vim Script
8
star
5

coderetreat.sckrk.com

Site of Code Retreat organized by SCKRK
CSS
5
star
6

redis_ring

A solution for sharding Redis
Ruby
4
star
7

timetracking

Command line interface to update various timetracking sites
Ruby
3
star
8

pouchlist

PouchDB+AngularJS+RxJS TodoMVC demo
JavaScript
3
star
9

process_pool

ProcessPool with interchangeable job queue backends for Ruby
Ruby
3
star
10

fun.rb

Making Ruby Fun(ctional)
Ruby
3
star
11

rhinestone

A proxy to rubygems.org
Ruby
3
star
12

rt-tickspot-client

RubyTime and TickSpot console client
Ruby
3
star
13

angular-prezentacja

Prezentacja o AngularJS na KRUG
JavaScript
3
star
14

sweetjsify

Sweet.js transform for Browserify
JavaScript
2
star
15

hero-notify

GAE app to check HTC Hero availability
Python
2
star
16

angularjs-demo

JavaScript
2
star
17

aspell_edit_dist

Gem that exposes limit_edit_distance function from Aspell.
C++
2
star
18

typing-test

Application to illustrate the services on rails blog post
Ruby
1
star
19

prezio

html5 presentation generator
Ruby
1
star
20

dzone-chrome

Chrome extension for DZone voting.
JavaScript
1
star
21

erb_rcov

Gem to calculate coverage of views in rails
Ruby
1
star
22

psyho-desktop

my desktop config
Ruby
1
star
23

redis_ring_client

Fat client for redis_ring
Ruby
1
star
24

adam.pohorecki.pl

my blog
HTML
1
star
25

snakes

Clojure
1
star
26

dependor-sinatra

Ruby
1
star
27

test-case

Test case for the Netlog OAuth stuff
Ruby
1
star
28

ace-most-tweets

simple script to find out who tweeted most during ace conf
Ruby
1
star
29

hero-notify-gtk

Hero Notifier for Ubuntu
Python
1
star
30

ruby-webapps

prezentacja na kgd.net
Ruby
1
star
31

gcj

some of my solutions to gcj problems
Python
1
star
32

til

Today I Learned
1
star
33

lpasswd

A very simple interface to change LDAP password
JavaScript
1
star
34

ioc_lighting_talk

1
star
35

homer.py

A utility script to rename TV episode files
Python
1
star
36

homer

A gem to rename tv show episode names
Ruby
1
star