Sha256: b5a15f8485ada30b2213e26494eda6347caafce4a307ec1638b454e3ceb943fb
Contents?: true
Size: 772 Bytes
Versions: 4
Compression:
Stored size: 772 Bytes
Contents
require File.expand_path('../../helper', __FILE__) describe 'Zen::Event' do after do Zen::Event::REGISTERED.delete(:test) end it 'Register an event' do Zen::Event.listen(:test) {} Zen::Event::REGISTERED.key?(:test).should == true end it 'Run a single event' do data = 0 Zen::Event.listen(:test) do |number| data = number end Zen::Event.call(:test, 10) data.should == 10 Zen::Event.call(:test, 12) data.should == 12 end it 'Run multiple events' do data = 0 Zen::Event.listen(:test) do |number| data += number end Zen::Event.listen(:test) do |number| data += (number * 2) end Zen::Event.call(:test, 10) Zen::Event.call(:test, 20) data.should == 90 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
zen-0.4.3 | spec/zen/event.rb |
zen-0.4.2 | spec/zen/event.rb |
zen-0.4.1 | spec/zen/event.rb |
zen-0.4 | spec/zen/event.rb |