From: Chris Jaekl Date: Sat, 22 Jun 2024 02:27:40 +0000 (-0400) Subject: Add SeriesTest X-Git-Url: https://jaekl.net/gitweb/?a=commitdiff_plain;h=92312798ac3ac988d3f7e2d4d4645b207a25f022;p=quanlib.git Add SeriesTest --- diff --git a/app/series.rb b/app/series.rb index 0621876..729f0db 100644 --- a/app/series.rb +++ b/app/series.rb @@ -56,10 +56,10 @@ class Series def inspect data = [] if nil != @age - data.push('age="' + @age.inspect + '"') + data.push('age=' + @age.inspect) end if nil != @code - data.push('code="' + @code.inspect + '"') + data.push('code=' + @code.inspect) end if nil != @descr data.push('descr="' + @descr + '"') @@ -70,7 +70,7 @@ class Series if nil != @grouping data.push('grouping="' + @grouping + '"') end - return '(Series:' + data.join(',') + ')' + return '(Series: ' + data.join(' ') + ')' end def key diff --git a/test/series_test.rb b/test/series_test.rb new file mode 100644 index 0000000..e0810c6 --- /dev/null +++ b/test/series_test.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require "test_helper" + +require "series" + +class SeriesTest < Minitest::Test + def test_inspect + age = "ya" + genre = "romance" + grouping = "LouisaAlcott" + code = "LW" + descr = "Little Women" + id = 1 + + series = Series.new(id) + series.age = age + series.genre = genre + series.grouping = grouping + series.code = code + series.descr = descr + + expected = '(Series: age="ya" code="LW" descr="Little Women" genre="romance" grouping="LouisaAlcott")' + + actual = series.inspect + + assert_equal expected, actual + end +end