push/atlas: ATLAS_TOKEN env var works [GH-5489]
This commit is contained in:
parent
b5e57a6e83
commit
d03b1f6930
|
@ -75,6 +75,7 @@ module VagrantPlugins
|
|||
def finalize!
|
||||
@address = nil if @address == UNSET_VALUE
|
||||
@token = nil if @token == UNSET_VALUE
|
||||
@token = ENV["ATLAS_TOKEN"] if !@token && ENV["ATLAS_TOKEN"] != ""
|
||||
@app = nil if @app == UNSET_VALUE
|
||||
@dir = "." if @dir == UNSET_VALUE
|
||||
@uploader_path = nil if @uploader_path == UNSET_VALUE
|
||||
|
|
|
@ -12,6 +12,12 @@ describe VagrantPlugins::AtlasPush::Config do
|
|||
|
||||
let(:machine) { double("machine") }
|
||||
|
||||
around(:each) do |example|
|
||||
with_temp_env("ATLAS_TOKEN" => nil) do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
subject.token = "foo"
|
||||
end
|
||||
|
@ -97,6 +103,17 @@ describe VagrantPlugins::AtlasPush::Config do
|
|||
end
|
||||
end
|
||||
|
||||
context "when a token is in the environment" do
|
||||
it "uses the token in the Vagrantfile" do
|
||||
with_temp_env("ATLAS_TOKEN" => "foo") do
|
||||
subject.finalize!
|
||||
end
|
||||
|
||||
expect(errors).to be_empty
|
||||
expect(subject.token).to eq("foo")
|
||||
end
|
||||
end
|
||||
|
||||
context "when no token is given" do
|
||||
before do
|
||||
allow(subject).to receive(:token_from_vagrant_login)
|
||||
|
|
Loading…
Reference in New Issue