From 92312798ac3ac988d3f7e2d4d4645b207a25f022 Mon Sep 17 00:00:00 2001 From: Chris Jaekl Date: Fri, 21 Jun 2024 22:27:40 -0400 Subject: [PATCH] Add SeriesTest --- app/series.rb | 6 +++--- test/series_test.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 test/series_test.rb 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 -- 2.39.2