0.01
No commit activity in last 3 years
No release in over 3 years
MiniTest assertions/expectations and stubbing for Wisper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Wisper::MiniTest

MiniTest assertions/expectations and stubbing for Wisper. Based on @krisleech work and his own wisper-rspec gem.

Gem Version Build Status

Installation

gem 'wisper-minitest', require: false

Usage

Broadcast assertion

In test_helper

require 'wisper/minitest/assertions'

In your tests:

assert_broadcast(:an_event) { publisher.execute }

This will match both broadcast(:an_event) and broadcast(:an_event, :arg_1).

# with optional arguments
assert_broadcast(:another_event, :arg1, :arg2) { publisher.execute }

With event arguments, it matches only if the event is broadcast with those arguments. This assertion matches broadcast(:another_event, :arg1, :arg2) but not broadcast(:another_event).

Todo

The wisper-rspec gem is not fully ported yet. Here's what's missing:

  • Convert broadcast expectation to assert_broadcast assertion
  • Add a refute_broadcast assertion
  • Make those available as Minitest expectations too
  • Document or implement a way to assert that a listener is receiving events
  • Port publisher stub feature

Contributing

Any contribution is welcome! Open an issue or send a pull request to get started.