Skip to content

Commit 6710c2c

Browse files
committed
clean: Update test to Scalatest
1 parent 21869b0 commit 6710c2c

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ scalaVersion := scala212
99

1010
crossScalaVersions := Seq(scala211, scala212, scala213)
1111

12-
libraryDependencies ++= Seq("org.specs2" %% "specs2-core" % "4.8.3" % Test)
12+
libraryDependencies ++= Seq("wordspec", "shouldmatchers").map(m => "org.scalatest" %% s"scalatest-$m" % "3.2.14" % Test)
1313

1414
unmanagedSourceDirectories in Compile += {
1515
val sourceDir = (sourceDirectory in Compile).value

src/test/scala/com.codacy.plugins.api.languages/LanguageSpec.scala

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.codacy.plugins.api.languages
22

3-
import org.specs2.control.NoLanguageFeatures
4-
import org.specs2.mutable.Specification
3+
import org.scalatest.matchers.should.Matchers
4+
import org.scalatest.OptionValues
5+
import org.scalatest.wordspec.AnyWordSpec
56

6-
class LanguageSpec extends Specification with NoLanguageFeatures {
7+
class LanguageSpec extends AnyWordSpec with Matchers with OptionValues {
78
"Languages" should {
89
"filter by language" in {
910
val expected = Seq("src/main/scala/com/codacy/File1.scala",
@@ -21,14 +22,15 @@ class LanguageSpec extends Specification with NoLanguageFeatures {
2122
Map((Languages.Scala, Set(".sc"))))
2223
.toList
2324

24-
files should containTheSameElementsAs(expected)
25+
files should contain theSameElementsAs expected
2526
}
2627

2728
"forPath" in {
28-
Languages.forPath("src/main/scala/com/codacy/File1.scala") should beEqualTo(Some(Languages.Scala))
29-
Languages.forPath("src/main/scala/com/codacy/File1.sc", List((Languages.Scala, Seq(".sc")))) should beEqualTo(
30-
Some(Languages.Scala))
31-
Languages.forPath("src/File3.mjs") should beEqualTo(Some(Languages.Javascript))
29+
Languages.forPath("src/main/scala/com/codacy/File1.scala").value shouldBe Languages.Scala
30+
Languages
31+
.forPath("src/main/scala/com/codacy/File1.sc", List((Languages.Scala, Seq(".sc"))))
32+
.value shouldBe Languages.Scala
33+
Languages.forPath("src/File3.mjs").value shouldBe Languages.Javascript
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)