spec/logout_spec.rb in ey-pro-cli-0.0.8 vs spec/logout_spec.rb in ey-pro-cli-0.0.9

- old
+ new

@@ -1,16 +1,18 @@ require 'spec_helper' describe EyProCli do describe "logout" do - context "with a token" do - before(:each) do - subject.class.core_file = @tempfile + context "without a token" do + before(:each) { subject.class.core_file = @tempfile } - allow(subject).to receive(:ask) { FFaker::Internet.email } - - expect(capture(:stdout) { subject.login }).to match(/writing token/i) + 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/")