Sha256: 0b40e211f6bca20c9323f2eace7f3daba4df882965254a9df07b0114cbc861bc

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

#!/usr/bin/env ruby
# coding: utf-8

require "test_helper"

require "highline/question"

class TestAnswerConverter < Minitest::Test
  def test_integer_convertion
    question = HighLine::Question.new("What's your age?", Integer)
    question.answer = "18"
    answer_converter = HighLine::Question::AnswerConverter.new(question)

    refute_equal "18", answer_converter.convert
    assert_equal   18, answer_converter.convert
  end

  def test_float_convertion
    question = HighLine::Question.new("Write PI", Float)
    question.answer = "3.14159"
    answer_converter = HighLine::Question::AnswerConverter.new(question)

    refute_equal "3.14159", answer_converter.convert
    assert_equal   3.14159, answer_converter.convert
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
highline-2.0.0.pre.develop.9 test/test_answer_converter.rb
highline-2.0.0.pre.develop.6 test/test_answer_converter.rb
highline-2.0.0.pre.develop.4 test/test_answer_converter.rb
highline-2.0.0.pre.develop.2 test/test_answer_converter.rb