Sha256: b1c620328132d0709ef52c60cf326f12c6283047b7586ddc6adf41c7fca57ea2

Contents?: true

Size: 481 Bytes

Versions: 8

Compression:

Stored size: 481 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe FiniteMachine::Hooks, '#call' do
  let(:object) { described_class }

  subject(:hooks) { object.new }

  it "adds and removes a single hook" do
    expect(hooks).to be_empty

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

    hooks.call(event_type, :foo) do |callback|
      yielded << callback
    end

    expect(yielded).to eq([hook])
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
finite_machine-0.10.0 spec/unit/hooks/call_spec.rb
finite_machine-0.9.2 spec/unit/hooks/call_spec.rb
finite_machine-0.9.1 spec/unit/hooks/call_spec.rb
finite_machine-0.9.0 spec/unit/hooks/call_spec.rb
finite_machine-0.8.1 spec/unit/hooks/call_spec.rb
finite_machine-0.8.0 spec/unit/hooks/call_spec.rb
finite_machine-0.7.1 spec/unit/hooks/call_spec.rb
finite_machine-0.7.0 spec/unit/hooks/call_spec.rb