gcounterfeiter

package module
v0.0.0-...-8a4c307 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2016 License: MIT Imports: 5 Imported by: 0

README

Go Report Card

Gomega Matchers for Counterfeiter

This package provides some helpful Gomega matchers that help you write effective assertions against counterfeiter fakes.

HaveReceived()

Verifies that a function was invoked on a counterfeiter fake.

e.g.:

myFake := new(FakeSomething)
myFake.Something("arg1", 0)
Expect(myFake).To(HaveReceived("Something").With(Equal("arg1")).AndWith(BeEquivalentTo(0)))

This actually works with any object that implements an "invocation recording" interface.

type Recorder interface{
  Invocations() map[string][][]interface{}
}

Implemented Features

  • one not need to specify a gomega matcher to check equality
    • e.g.: these are equivalent:
    • Expect(myFake).To(HaveReceived("Something").With(Equal("arg1"), Equal(0)))
    • Expect(myFake).To(HaveReceived("Something").With("arg1", 0))

Planned Features

(These would be good for new contributors)

  • I should be able to specify multiple arguments at once
    • e.g.: Expect(myFake).To(HaveReceived("Something").With(Equal("my-arg", Equal(0)))
  • I should be able to specify a number of times a function was invoked
    • e.g.: Expect(myFake).To(HaveReceived("Something").Times(1))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewArgumentVerifyingMatcher

func NewArgumentVerifyingMatcher(baseMatcher types.GomegaMatcher, functionToMatch string, argMatchers ...types.GomegaMatcher) *argumentVerifyingMatcher

Types

type HaveReceivableMatcher

type HaveReceivableMatcher interface {
	types.GomegaMatcher
	With(...interface{}) HaveReceivableMatcher
	AndWith(...interface{}) HaveReceivableMatcher
}

func HaveReceived

func HaveReceived(args ...string) HaveReceivableMatcher

Directories

Path Synopsis
fixturesfakes
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL