Sha256: 49f0c7505156fabf5b027ead15b30752b621ed130e514301df4badf80daa24ea
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require 'test_helper' module Vedeu describe Events do describe '#add' do it 'adds the event' do Events.add(:sulphur) { proc { |x| x } } Events.registered.must_include(:sulphur) end end describe '#remove' do it 'removes the event by name' do Events.add(:chlorine) { proc { |x| x } } Events.add(:argon) { proc { |y| y } } Events.remove(:chlorine) Events.registered.wont_include(:chlorine) end it 'removes the event by name only if the name exists' do Events.add(:chlorine) { proc { |x| x } } Events.add(:argon) { proc { |y| y } } Events.remove(:potassium).must_equal(false) end end describe '#trigger' do it 'returns the result of triggering the event' do NastyException = Class.new(StandardError) Events.add(:_nasty_exception_) { fail NastyException } proc { Events.use(:_nasty_exception_) }.must_raise(NastyException) end it 'returns an empty collection when the event has not been registered' do Events.use(:_not_found_).must_be_empty end end end # Events end # Vedeu
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.7 | test/lib/vedeu/repositories/events_test.rb |
vedeu-0.2.6 | test/lib/vedeu/repositories/events_test.rb |
vedeu-0.2.5 | test/lib/vedeu/repositories/events_test.rb |