Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bogus

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bogus

  • 0.1.7
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 08 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc