Sha256: fa14770644810af724cf942ea296a9e9d609243dcd7c8170a5bcad97e5bb6d97
Contents?: true
Size: 722 Bytes
Versions: 2
Compression:
Stored size: 722 Bytes
Contents
# encoding: utf-8 require 'spec_helper' RSpec.describe FiniteMachine::Subscribers do let(:machine) { double } let(:event) { double } let(:listener) { double } subject(:subscribers) { described_class.new(machine) } before { subscribers.subscribe(listener) } it "checks if any subscribers exist" do expect(subscribers.empty?).to be(false) end it "returns index for the subscriber" do expect(subscribers.index(listener)).to eql(0) end it "visits all subscribed listeners for the event" do expect(event).to receive(:notify).with(listener) subscribers.visit(event) end it "resets the subscribers" do subscribers.reset expect(subscribers.empty?).to be(true) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
finite_machine-0.10.2 | spec/unit/subscribers_spec.rb |
finite_machine-0.10.1 | spec/unit/subscribers_spec.rb |