~singpolyma/sgx-jmp

15ca96c2eaa988507053edc401a06f0dfad7e6da — Stephen Paul Weber 2 years ago 5d2a8e6
Format tel for human reader
2 files changed, 4 insertions(+), 3 deletions(-)

M lib/tel_selections.rb
M test/test_tel_selections.rb
M lib/tel_selections.rb => lib/tel_selections.rb +2 -1
@@ 115,7 115,8 @@ class TelSelections
			end

			def to_s
				"#{@tel} (#{@locality}, #{@region})"
				@tel =~ /\A\+1(\d{3})(\d{3})(\d+)\Z/
				"(#{$1}) #{$2}-#{$3} (#{@locality}, #{@region})"
			end
		end


M test/test_tel_selections.rb => test/test_tel_selections.rb +2 -2
@@ 66,7 66,7 @@ class TelSelectionsTest < Minitest::Test
		end

		def test_to_s
			assert_equal "+15551234567 (Toronto, ON)", @tn.to_s
			assert_equal "(555) 123-4567 (Toronto, ON)", @tn.to_s
		end

		def test_tel


@@ 75,7 75,7 @@ class TelSelectionsTest < Minitest::Test

		def test_option
			assert_equal(
				{ label: "+15551234567 (Toronto, ON)", value: "+15551234567" },
				{ label: "(555) 123-4567 (Toronto, ON)", value: "+15551234567" },
				@tn.option
			)
		end