Add a simple helper function to find out whether we have been configured for Sauce Labs or not

This commit is contained in:
R. Tyler Croy 2012-11-11 16:45:52 -08:00
parent bf6102ada8
commit 596ccd8e76
2 changed files with 28 additions and 0 deletions

View File

@ -58,6 +58,12 @@ access_key: #{apikey}
def chrome
display 'Sauce for Heroku has not yet been configured!'
end
def configured?
File.exists?('ondemand.yml') ||
File.exists?(File.expand_path('~/.sauce/ondemand.yml'))
end
end
end
end

View File

@ -2,4 +2,26 @@ require 'spec_helper'
describe Heroku::Command::Sauce do
it { should be_instance_of Heroku::Command::Sauce }
describe '#configured?' do
let(:exists) { false }
before :each do
File.stub(:exists?).with(
'ondemand.yml').and_return(exists)
File.stub(:exists?).with(
File.expand_path('~/.sauce/ondemand.yml')).and_return(exists)
end
context 'by default' do
it { subject.should_not be_configured }
end
context 'when configured' do
let(:exists) { true }
it { subject.should be_configured }
end
end
end