Sha256: 01f028c8b1c410bea758a21ad2128eaa28c467c666c04dc150e92e8ae2bb5e31

Contents?: true

Size: 722 Bytes

Versions: 7

Compression:

Stored size: 722 Bytes

Contents

require 'test/unit'
require 'highline/import'
require 'highline/simulate'

class SimulatorTest < Test::Unit::TestCase
  def setup
    input     = StringIO.new
    output    = StringIO.new
    $terminal = HighLine.new(input, output)
  end

  def test_simulator
    HighLine::Simulate.with('Bugs Bunny', '18') do
      name = ask('What is your name?')

      assert_equal 'Bugs Bunny', name

      age = ask('What is your age?')

      assert_equal '18', age
    end
  end

  def test_simulate_with_echo_and_frozen_strings
    HighLine::Simulate.with('the password'.freeze) do
      password = ask('What is your password?') do |q|
        q.echo = '*'
      end

      assert_equal 'the password', password
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
brakeman-4.3.1 bundle/ruby/2.5.0/gems/highline-1.7.10/test/tc_simulator.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/highline-1.7.10/test/tc_simulator.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/highline-1.7.10/test/tc_simulator.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/highline-1.7.10/test/tc_simulator.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/highline-1.7.10/test/tc_simulator.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/highline-1.7.10/test/tc_simulator.rb
highline-1.7.10 test/tc_simulator.rb