Skip to content

Commit 1da9113

Browse files
committed
Reduce duplication
1 parent d1b3b09 commit 1da9113

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

publication/src/test/scala/hmda/publication/reports/util/RaceUtilSpec.scala

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.scalatest.{ AsyncWordSpec, MustMatchers }
1212

1313
class RaceUtilSpec extends AsyncWordSpec with MustMatchers with SourceUtils with ApplicantSpecUtil {
1414

15+
def minority = Gen.oneOf(1, 2, 3, 4).sample.get
1516
def nonWhiteRaceGen = Gen.oneOf("1", "2", "3", "4").sample.get
1617
def coApplicantNotWhite(app: Applicant) = {
1718
app.copy(coRace1 = nonWhiteRaceGen.toInt, coRace2 = nonWhiteRaceGen, coRace3 = nonWhiteRaceGen,
@@ -141,8 +142,6 @@ class RaceUtilSpec extends AsyncWordSpec with MustMatchers with SourceUtils with
141142
}
142143

143144
"'Two Or More Minority' race filter" must {
144-
def minority = Gen.oneOf(1, 2, 3, 4).sample.get
145-
146145
"include applications that meet 'Two Or More Minority' criteria" in {
147146
val lars = larCollectionWithApplicant { app =>
148147
val withQualifyingCoApp = coApplicantNotWhite(app)
@@ -164,8 +163,6 @@ class RaceUtilSpec extends AsyncWordSpec with MustMatchers with SourceUtils with
164163
}
165164

166165
"'Joint' race filter" must {
167-
def minority = Gen.oneOf(1, 2, 3, 4).sample.get
168-
169166
"include applications with white applicant and minority coApplicant" in {
170167
val lars = larCollectionWithApplicant { app =>
171168
app.copy(race1 = 5, race2 = "", race3 = "", race4 = "", race5 = "", coRace1 = minority)
@@ -196,12 +193,9 @@ class RaceUtilSpec extends AsyncWordSpec with MustMatchers with SourceUtils with
196193

197194
}
198195
"exclude lars with only one applicant" in {
199-
val excludedLars = larCollectionWithApplicant { app =>
200-
app.copy(race1 = minority, coRace1 = 8)
201-
}
196+
val excludedLars = larCollectionWithApplicant(_.copy(race1 = minority, coRace1 = 8))
202197
val nonJointLars = filterRace(source(excludedLars), Joint)
203198
count(nonJointLars).map(_ mustBe 0)
204-
205199
}
206200
}
207201

0 commit comments

Comments
 (0)