Socket
Book a DemoInstallSign in
Socket

arbitrary_mock

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arbitrary_mock

0.1.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

ArbitraryMock

ArbitraryMock is a basic object used for easily asserting the behaviours of utility classes without loading the dependencies themselves, or making specific assertions about the way the class functions.

Example

Basic

2.0.0p247 :003 > require 'arbitrary_mock'
=> true
2.0.0p247 :004 > mock = ArbitraryMock::Base.new(foo: 'bar')
=> #<ArbitraryMock::Base:0x007f97710eade8 @property_hash={:foo=>"bar"}>
2.0.0p247 :005 > mock.foo
=> "bar"
2.0.0p247 :007 > mock.foo = 'baz'
=> "baz"
2.0.0p247 :009 > mock.foo << 'quux'
=> "bazquux"

Usage

# Check if it already exists, if so we don't need to fake it
Model ||= ArbitraryMock::Base
dependency = Model.new(foo: 'bar')
Model.stub(new: dependency)

## insert logic here
expect(dependency.attribute).to match 'some_value'

This project rocks and uses MIT-LICENSE.

FAQs

Package last updated on 16 Jan 2014

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.