-
-
Save jimweirich/5639114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'EventBus methods cascade' do | |
Invariant { result.should == EventBus } | |
context 'clear' do | |
When(:result) { EventBus.clear } | |
Then { } | |
end | |
context 'publish' do | |
When(:result) { EventBus.publish('aa123bb', {}) } | |
Then { } | |
end | |
context 'subscribe' do | |
When(:result) { EventBus.subscribe('aa123bb', listener, :handler) } | |
Then { } | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'when called incorrectly' do | |
def it_fails | |
subscribe.should have_failed(ArgumentError) | |
end | |
context 'when specifying the event name' do | |
context 'must provide a method or a block' do | |
When(:subscribe) { EventBus.subscribe('blah', listener) } | |
Then { it_fails } | |
end | |
context 'cannot provide a method AND a block' do | |
When(:subscribe) { EventBus.subscribe('blah', listener, :handler) {|info| }} | |
Then { it_fails } | |
end | |
context 'must provide a block when no method is supplied' do | |
When(:subscribe) { EventBus.subscribe('blah') } | |
Then { it_fails } | |
end | |
end | |
context 'when specifying a listener object' do | |
context 'when a method is also provided' do | |
When(:subscribe) { EventBus.subscribe(listener, double) } | |
Then { it_fails } | |
end | |
context 'when a block is also provided' do | |
When(:subscribe) { EventBus.subscribe(listener) {|info| } } | |
Then { it_fails } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment