Sha256: 5d5c16dab5e1bacbe98ddcaef40b08e87a54a0da7c0b27e6cc6787d0f684fd09

Contents?: true

Size: 842 Bytes

Versions: 13

Compression:

Stored size: 842 Bytes

Contents

require "utils"
require 'capistrano/cli/ui'

class CLIUITest < Test::Unit::TestCase
  class MockCLI
    include Capistrano::CLI::UI
  end

  def test_ui_should_return_highline_instance
    assert_instance_of HighLine, MockCLI.ui
  end

  def test_password_prompt_should_have_default_prompt_and_set_echo_false
    q = mock("question")
    q.expects(:echo=).with(false)
    ui = mock("ui")
    ui.expects(:ask).with("Password: ").yields(q).returns("sayuncle")
    MockCLI.expects(:ui).returns(ui)
    assert_equal "sayuncle", MockCLI.password_prompt
  end

  def test_password_prompt_with_custom_prompt_should_use_custom_prompt
    ui = mock("ui")
    ui.expects(:ask).with("Give the passphrase: ").returns("sayuncle")
    MockCLI.expects(:ui).returns(ui)
    assert_equal "sayuncle", MockCLI.password_prompt("Give the passphrase: ")
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
capistrano-2.15.11 test/cli/ui_test.rb
capistrano-2.15.10 test/cli/ui_test.rb
capistrano-2.15.9 test/cli/ui_test.rb
capistrano-2.15.8 test/cli/ui_test.rb
capistrano-2.15.7 test/cli/ui_test.rb
capistrano-2.15.6 test/cli/ui_test.rb
capistrano-2.15.5 test/cli/ui_test.rb
minmb-capistrano-2.15.4 test/cli/ui_test.rb
capistrano-2.15.4 test/cli/ui_test.rb
capistrano-2.15.3 test/cli/ui_test.rb
capistrano-2.15.2 test/cli/ui_test.rb
capistrano-2.15.0 test/cli/ui_test.rb
capistrano-2.15.1 test/cli/ui_test.rb