spec/engineyard/cli/api_spec.rb in engineyard-1.3.14 vs spec/engineyard/cli/api_spec.rb in engineyard-1.3.15
- old
+ new
@@ -20,17 +20,18 @@
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')
- capture_stdio("\n\n") do
- @token = EY::CLI::API.new
- end
+ EY::CLI::UI::Prompter.enable_mock!
+ EY::CLI::UI::Prompter.backend.next_answer = "my@email.example.com"
+ EY::CLI::UI::Prompter.backend.next_answer = "secret"
+
+ @token = EY::CLI::API.new
end
it "asks you for your credentials" do
- @out.should include("Email:")
- @out.should include("Password:")
+ EY::CLI::UI::Prompter.backend.questions.should == ["Email: ","Password: "]
end
it "gets the api token" do
@token.should == EY::CLI::API.new("asdf")
end
\ No newline at end of file