require 'spec_helper' describe EyProCli do describe "logout" do context "without a token" do before(:each) { subject.class.core_file = @tempfile } it "handles a missing token" do expect(capture(:stdout) { subject.logout }).to match(/no api token found/i) end end context "with a token" do before(:each) { create_core_credentials } it "removes the token" do expect(capture(:stdout) { subject.logout }).to match(/successfully removed api token/i) expect(read_yaml(@tempfile)).not_to have_key("https://api.engineyard.com/") end end end end