Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Last active December 21, 2015 15:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dchelimsky/6327095 to your computer and use it in GitHub Desktop.
Save dchelimsky/6327095 to your computer and use it in GitHub Desktop.
Another approach to spec'ing message expectations without caring about return values, as described in http://tatey.com/2013/08/24/dont-care-about-the-return-value-of-outgoing-commands/
describe Task::RestartProcesses do
describe '#run_with_error' do
let(:client) { double('HerokuClient').as_null_object }
let(:logger) { double('Logger').as_null_ojbect }
let(:task) { Task::RestartProcesses.new logger: logger }
before do
# Inject Dependencies
task.client = client
# Run
task.run_with_error
end
it 'restarts processes' do
expect(client).to have_received(:post_ps_restart)
end
it 'logs' do
expect(logger).to have_received(:info).with('Restarting processes')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment