Sha256: e4e16638cc7aa84d38b326adf5ae82c01eeb491f7b92537d503c28e024d1e7f8

Contents?: true

Size: 407 Bytes

Versions: 2

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

RSpec.describe FiniteMachine::Hooks, '#clear' do
  it "clears all registered hooks" do
    hooks = described_class.new

    event_type = FiniteMachine::HookEvent::Before
    hook = -> { }
    hooks.register(event_type, :foo, hook)
    hooks.register(event_type, :bar, hook)

    expect(hooks.empty?).to eq(false)
    hooks.clear
    expect(hooks.empty?).to eq(true)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.12.1 spec/unit/hooks/clear_spec.rb
finite_machine-0.12.0 spec/unit/hooks/clear_spec.rb