Sha256: 7f368f9f625ff9aa858297f6bfb0e84ce855c9420f0e826b807b9d068826a83e
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# encoding: utf-8 require 'spec_helper' require "hackpad/cli/config" describe Hackpad::Cli::Config do let(:configdir) { File.expand_path('../../../../files', __FILE__) } let(:configfile) { File.join(configdir, 'default.yml') } let(:options) { { configdir: configdir, workspace: 'default' } } before :each do FileUtils.mkdir_p configdir unless Dir.exists?(configdir) end after :each do FileUtils.rm configfile if File.exists? configfile end describe ".load" do let(:config) { {'xx' => 'oo'} } context "when there is no config file," do it "calls for setup" do subject.stub(:setup).with(configfile) File.open(configfile, "w") do |f| f.write YAML::dump(config) end expect(subject.load options).to eq config end end end describe ".setup" do context "when normal input is provided," do let(:input) { StringIO.new } let(:output) { StringIO.new } it "handles setup interactively" do input.stub(:gets).and_return("client_id","secret","site") subject.send :setup, configfile, input, output expect(File.read configfile).to eq "---\nclient_id: client_id\nsecret: secret\nsite: site\n" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hackpad-cli-0.0.7 | spec/lib/hackpad/cli/config_spec.rb |