Add a simple helper function to find out whether we have been configured for Sauce Labs or not
This commit is contained in:
parent
bf6102ada8
commit
596ccd8e76
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue