Skip to content

Instantly share code, notes, and snippets.

Created August 8, 2016 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/da731b1b4eff7efbb7ca6771f4b84ea1 to your computer and use it in GitHub Desktop.
Save anonymous/da731b1b4eff7efbb7ca6771f4b84ea1 to your computer and use it in GitHub Desktop.
it 'throws a Psych::SyntaxError and continues without credentials when there are syntax errors in the auth file' do
data = "{:default'=>{:my_token=>'123456abcdef'}}"
allow_any_instance_of( MyApp::Parser ).to \
receive(:read_file).and_return(data)
logger = double('logger')
expect(logger).to receive(:warn).with(/Psych::SyntaxError: .* has invalid syntax/)
make_opts = {:logger => logger}
parser = MyApp::Parser.new( make_hosts, make_opts )
expect( parser.credentials ).to be == { }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment