Sha256: 40df5012747acdf67eead0e4cbdd424e1882ca6db99bed66336529bdde2389c7
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
require 'ego/robot' RSpec.describe Ego::Robot do it 'sets its name' do formatter = double('Ego::Formatter') options = double('Ego::Options') allow(options).to receive(:verbose) expect(options).to receive_messages(robot_name: 'foo') robot = Ego::Robot.new(options, formatter) expect(robot.name).to eq('foo') end describe '#debug' do context 'in non-verbose mode' do before(:example) do @options = double('Ego::Options') allow(@options).to receive_messages(robot_name: 'foo', verbose: false) @formatter = double('Ego::Formatter') end it 'does nothing' do expect(@formatter).not_to receive(:debug) robot = Ego::Robot.new(@options, @formatter) robot.debug 'foo' end end context 'in verbose mode' do before(:example) do @options = double('Ego::Options') allow(@options).to receive_messages(robot_name: 'foo', verbose: true) @formatter = double('Ego::Formatter') end it 'passes the message to the formatter' do expect(@formatter).to receive(:debug).with('foo') robot = Ego::Robot.new(@options, @formatter) robot.debug 'foo' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ego-0.3.0 | spec/ego/robot_spec.rb |
ego-0.2.0 | spec/ego/robot_spec.rb |
ego-0.1.0 | spec/ego/robot_spec.rb |