# -*- coding: utf-8 -*- require 'spec_helper' describe Sconb do context '`dump` command' do it "should convert from .ssh/config to JSON" do expect(capture(:stdout) { Sconb::CLI.new.invoke(:dump, [], {config: File.expand_path('../config_test', __FILE__)}) }).to eq < 2> /dev/null\\"": { "Match": "exec \\"nmcli connection status id 2> /dev/null\\"", "ProxyCommand": "ssh -W %h:%p github.com" }, "gist": { "Host": "gist", "User": "git", "Port": "22", "Hostname": "gist.github.com", "IdentityFile": [ "spec/github_rsa" ], "TCPKeepAlive": "yes", "IdentitiesOnly": "yes" } } OUT end it "should convert from multi config to JSON with filter" do expect(capture(:stdout) { Sconb::CLI.new.invoke(:dump, ['gis?t'], {config: File.expand_path('../config_test_multi', __FILE__)}) }).to eq < < 2> /dev/null\\"": { "Match": "exec \\"nmcli connection status id 2> /dev/null\\"", "ProxyCommand": "ssh -W %h:%p github.com" } } INN ) end it "should convert from JSON to config" do expect(capture(:stdout) { @cli.restore }).to eq < 2> /dev/null" ProxyCommand ssh -W %h:%p github.com OUT end end context '`keyregen` command' do before do @cli = Sconb::CLI.new allow(@cli).to receive_messages(:stdin_read => <