Sha256: ba9d92af5814123d205e9e45640667938d4b12dafd79a172c4c9a2aa22e15132

Contents?: true

Size: 868 Bytes

Versions: 9

Compression:

Stored size: 868 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")
  end

  it "uses strict 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

9 entries across 9 versions & 1 rubygems

Version Path
eye-patch-0.1.3 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.2 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.1 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.1.0 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.0.9 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.0.8 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.0.7 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.0.6 test/lib/eye/patch/value_parser_test.rb
eye-patch-0.0.5 test/lib/eye/patch/value_parser_test.rb