Created
January 8, 2016 19:46
-
-
Save rdammkoehler/4eed196feda27a2ed924 to your computer and use it in GitHub Desktop.
Sneaky Gimme Tricks
This file contains 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
let(:factory) { gimme(ServiceLoaderFactory) } | |
let(:uri) { 'endpoint' } | |
# ... | |
it 'handles both failure and success appropriately' do | |
@idx = 0 | |
give(factory).create { | |
@idx += 1 | |
[ Proc.new { fail 'massively' }, Proc.new { } ][@idx-1].call | |
} | |
main.run [uri], 2 | |
expect(File.read('factory.log')).to include 'WARN -- : massively (RuntimeError)' | |
expect(File.read('factory.log')).to include "WARN -- : attempt 1 of 2; #{uri}" | |
expect(File.read('factory.log')).to include "INFO -- : success get_pages #{uri}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment