Sha256: b1b439e7a4bac9c19a8bc907d6c358c563c5d7b89275eb49e52ff8ab1dd0b017

Contents?: true

Size: 1.64 KB

Versions: 95

Compression:

Stored size: 1.64 KB

Contents

#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Portions of this code from heroku (https://github.com/heroku/heroku/) Copyright Heroku 2008 - 2012,
# used under an MIT license (https://github.com/heroku/heroku/blob/master/LICENSE).
#

require "spec_helper"
require "mortar/command/auth"

describe Mortar::Command::Auth do
  
  describe "auth:key" do
    it "displays the user's api key" do
      mock(Mortar::Auth).password {"foo_api_key"}
      stderr, stdout = execute("auth:key")
      stderr.should == ""
      stdout.should == <<-STDOUT
foo_api_key
STDOUT
    end
  end
    
  describe "auth:whoami" do
    it "displays the user's email address" do
      mock(Mortar::Auth).has_credentials.returns(true)
      mock(Mortar::Auth).get_credentials {["sam@mortardata.com", nil]}
      stderr, stdout = execute("auth:whoami")
      stderr.should == ""
      stdout.should == <<-STDOUT
sam@mortardata.com
STDOUT
    end

    it "displays nothing if not logged in" do
      mock(Mortar::Auth).has_credentials.returns(false)
      stderr, stdout = execute("auth:whoami")
      stderr.should == ""
      stdout.should == ""
    end

  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
mortar-0.15.53 spec/mortar/command/auth_spec.rb
mortar-0.15.52 spec/mortar/command/auth_spec.rb
mortar-0.15.51 spec/mortar/command/auth_spec.rb
mortar-0.15.50 spec/mortar/command/auth_spec.rb
mortar-0.15.49 spec/mortar/command/auth_spec.rb
mortar-0.15.48 spec/mortar/command/auth_spec.rb
mortar-0.15.47 spec/mortar/command/auth_spec.rb
mortar-0.15.46 spec/mortar/command/auth_spec.rb
mortar-0.15.45 spec/mortar/command/auth_spec.rb
mortar-0.15.44 spec/mortar/command/auth_spec.rb
mortar-0.15.43 spec/mortar/command/auth_spec.rb
mortar-0.15.42 spec/mortar/command/auth_spec.rb
mortar-0.15.41 spec/mortar/command/auth_spec.rb
mortar-0.15.40 spec/mortar/command/auth_spec.rb
mortar-0.15.39 spec/mortar/command/auth_spec.rb
mortar-0.15.38 spec/mortar/command/auth_spec.rb
mortar-0.15.37 spec/mortar/command/auth_spec.rb
mortar-0.15.36 spec/mortar/command/auth_spec.rb
mortar-0.15.35 spec/mortar/command/auth_spec.rb
mortar-0.15.34 spec/mortar/command/auth_spec.rb