Sha256: 2b114092cdc1faa39b11b649ffa9d35746c49d2582841d05cd1bac847eaccd59
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
describe SlackRubyBot::Hooks::HookSupport do subject do Class.new do include SlackRubyBot::Hooks::HookSupport on 'hello' do |_ = nil, _ = nil| 'hello' end on 'hello' do |_ = nil, _ = nil| 'hello-2' end on 'goodbye' do |_ = nil, _ = nil| 'goodbye' end end end describe 'hook code blocks' do it "let's you define class level code blocks" do expect(subject.hook_blocks.size).to eq(2) expect(subject.hook_blocks.keys).to eq %w(hello goodbye) expect(subject.hook_blocks['hello'].size).to eq(2) expect(subject.hook_blocks['goodbye'].size).to eq(1) expect(subject.hook_blocks['hello'].first.call).to eq('hello') expect(subject.hook_blocks['hello'].last.call).to eq('hello-2') expect(subject.hook_blocks['goodbye'].last.call).to eq('goodbye') end end describe '#flush_hook_blocks' do it 'registers class hook blocks as hook handlers in set' do object = subject.new expect(object.hooks).to receive(:add).exactly(3).times.and_call_original expect do object.flush_hook_blocks end.to change { object.hooks.handlers.size }.by(2) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slack-ruby-bot-0.10.3 | spec/slack-ruby-bot/hooks/hook_support_spec.rb |
slack-ruby-bot-0.10.2 | spec/slack-ruby-bot/hooks/hook_support_spec.rb |