Sha256: c3ee3bfd68cb8a466670de8e734491da3caf31bf4271530bd303f689d825b690

Contents?: true

Size: 950 Bytes

Versions: 15

Compression:

Stored size: 950 Bytes

Contents

require_relative "../../../test_helper"

describe Eye::Patch::ValueParser do

  it "parses time values" do
    assert_equal 2.weeks, Eye::Patch::ValueParser.parse("2 weeks")
    assert_equal 1.5.hours, Eye::Patch::ValueParser.parse("1.5 hours")
    assert_equal 50.minutes, Eye::Patch::ValueParser.parse("50 minutes")
    assert_equal 3.seconds, Eye::Patch::ValueParser.parse("3 seconds")
  end

  it "parses size values" do
    assert_equal 3.2.gigabytes, Eye::Patch::ValueParser.parse("3.2 gigabytes")
    assert_equal 2.4.megabytes, Eye::Patch::ValueParser.parse("2.4 megabytes")
    assert_equal 1.kilobyte, Eye::Patch::ValueParser.parse("1 kilobyte")
    assert_equal 1.terabyte, Eye::Patch::ValueParser.parse("1 terabyte  ")
  end

  it "uses whitespace as word boundary characters" do
    assert_equal "second-thing", Eye::Patch::ValueParser.parse("second-thing")
    assert_equal "minutes", Eye::Patch::ValueParser.parse("minutes")
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
eye-patch-0.5.1 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.5.0 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.4.2 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.4.1 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.4.0 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.3.1 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.3.0 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.2.2 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.2.1 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.2.0 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.8 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.7 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.6 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.5 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.4 test/lib/eye/patch/value_parser_test.rb