spec/engineyard/cli/api_spec.rb in engineyard-1.4.14 vs spec/engineyard/cli/api_spec.rb in engineyard-1.4.15
- old
+ new
@@ -13,9 +13,15 @@
it "gets the api token from ~/.eyrc if possible" do
write_eyrc({"api_token" => "asdf"})
EY::CLI::API.new.should == EY::CLI::API.new("asdf")
end
+ it "uses the token from $ENGINEYARD_API_TOKEN if set" do
+ ENV['ENGINEYARD_API_TOKEN'] = 'envtoken'
+ EY::CLI::API.new.token.should == 'envtoken'
+ ENV.delete('ENGINEYARD_API_TOKEN')
+ end
+
context "without saved api token" do
before(:each) do
FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/authenticate", :body => %|{"api_token": "asdf"}|, :content_type => 'application/json')
EY::CLI::UI::Prompter.enable_mock!