Sha256: 52f4237e61b611eb551eb0591cdd8023dd2a32b4e828c15090208a783f5662d9
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require 'spec_helper' describe GithubCLI::CLI do let(:object) { described_class } let(:config) { stub(:config).as_null_object } let(:ui) { stub(:ui) } before { GithubCLI.stub(:ui).and_return(ui) GithubCLI.stub(:config).and_return(config) } context 'whoami' do let(:config) { {'user.login' => nil } } it 'checks config for user info' do ui.should_receive(:info).with(/Not authed/) subject.invoke 'whoami', [] end end context 'init' do it 'confirms config creation' do ui.should_receive(:confirm).with(/Writing new configuration file/) File.stub(:exists?).and_return(false) subject.invoke "init", [] end it 'aborts if config already exists' do ui.should_receive(:error).with(/Not overwritting existing/) File.stub(:exists?).and_return(true) expect { subject.invoke "init", [] }.to raise_error(SystemExit) end it 'allows to overwrite existing config' do ui.should_receive(:confirm).with(/Writing new configuration file/) File.stub(:exists?).and_return(true) subject.invoke "init", [], {:force => true} end end context 'config' do let(:name) { 'core.editor' } before { File.stub(:exists?).and_return(true) GithubCLI::Terminal.stub(:line) } it 'aborts without config file' do ui.should_receive(:error).with(/Configuration file does not exist/) File.stub(:exists?).and_return(false) expect { subject.invoke "config", [] }.to raise_error(SystemExit) end it 'prints option for list flag' do GithubCLI::Terminal.should_receive(:print_config).with(name) subject.invoke "config", [name], {:list => true} end it 'print whole config without parameters' do GithubCLI::Terminal.should_receive(:print_config) subject.invoke "config", [] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
github_cli-0.6.2 | spec/github_cli/cli_spec.rb |
github_cli-0.6.1 | spec/github_cli/cli_spec.rb |