Sha256: 7ab57ba255149e009bcde563035871d994868eeb699d4b4b7fe28e216f7618b3
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 Bytes
Contents
require 'dry/events/listener' RSpec.describe Dry::Events::Listener do subject(:listener) do Class.new { include Dry::Events::Listener[:test_publisher] } end let!(:publisher) do Class.new { include Dry::Events::Publisher[:test_publisher] register_event :test_event }.new end describe '.subscribe' do it 'subscribes a listener at class level' do result = [] listener.subscribe(:test_event) do |event| result << event.id end publisher.publish(:test_event) expect(result).to eql([:test_event]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-events-0.1.0 | spec/unit/dry/events/listener_spec.rb |