Sha256: 3b1ed928e98e3313b8d77a75f41e55fe9fded798882ac47bf481446a3e24dbc8
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Jace::Registry do describe 'yard' do subject(:registry) { described_class.new } describe '#register' do it 'register a new handler for an event' do registry.register(:the_event) do do_something_after end end it 'register a new handler for before an event' do registry.register(:the_event, :before) do do_something_before end end end describe '#trigger' do let(:context) { SomeContext.new } let(:expected_texts) do [ 'doing something before', 'doing something middle', 'doing something after' ] end it 'runs the event handlers' do registry.register(:the_event) { do_something(:after) } registry.register(:the_event, :before) { do_something(:before) } registry.trigger(:the_event, context) do context.do_something(:middle) end expect(context.text) .to eq(expected_texts) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jace-0.1.1 | spec/integration/yard/jace/registry_spec.rb |
jace-0.1.0 | spec/integration/yard/jace/registry_spec.rb |