Sha256: 63e150467b49891dfd5eb10201a43f298969a67b7412fd7878dfb23305519afc
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true require 'ego/robot' RSpec.describe Ego::Robot, 'with status plug-in', plugin: 'status' do it { should be_able_to 'report robot status' } it { should handle_query 'status' } it { should handle_query 'what is your status' } it { should handle_query 'diagnostic' } it { should handle_query 'diagnostics' } it { should handle_query 'do self-diagnostic' } it { should handle_query 'uptime' } it { should handle_query 'what is your uptime' } describe '#on_status' do it 'is defined' do expect(subject.respond_to?(:on_status)).to be true end it 'can be hooked into' do subject.on_status { print '--status--' } expect { subject.run_hook :on_status }.to output(/--status--/).to_stdout end end describe 'handler' do it 'runs the on_status hook' do allow(subject).to receive(:puts) allow(subject).to receive(:run_hook) expect(subject).to receive(:run_hook).with(:on_status) subject.handle('status') end it 'prints an emote' do allow(subject).to receive(:run_hook) expect { subject.handle('status') }.to output( <<~OUT *running self-diagnostics* OUT ).to_stdout end it 'prints robot uptime' do expect { subject.handle('status') }.to output( /uptime: \d+ seconds\n/ ).to_stdout end it 'prints robot verbosity' do expect { subject.handle('status') }.to output( /verbosity: (normal|verbose)\n/ ).to_stdout end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ego-0.6.0 | spec/ego/plugins/status_spec.rb |