require 'spec_helper' require 'app42/base/constants' describe 'App42::Command' do describe 'UserToken' do it 'should ensure config dir' do FileUtils.mkdir_p(config_path).first.should eql "#{Dir.home}/.app42" end it 'should check key file presence?' do info = YAML.load_file(key_path) info['api_key'].should_not be_nil info['secret_key'].should_not be_nil end it 'should return config path' do config_path.should eql "#{Dir.home}/.app42" end it 'should return key_file' do key_path.should eql "#{Dir.home}/.app42/app42paas.yml" expect(key_path).to end_with(".yml") end # it 'should remove key file' do # FileUtils.rm_f(key_path) # expect { YAML.load_file(key_path) }.to raise_error(Errno::ENOENT) # end def config_path File.expand_path(App42::CONFIG_DIR) end def key_path File.expand_path(App42::KEYS_FILE) end end end