Specs2类中未解析的符号s2

时间:2013-05-23 15:12:04

标签: specs2

当我编译我的规范时,编译器告诉我

  

“错误:值s2不是StringContext的成员”

我的规范类的重要部分是:

import org.specs2._
import specification._
import mock._

class EnterpriseDirectoryActionSpec extends Specification { def is = s2"""
  An enterprise directory action should provide enabled fields
    after a call to doDefault                                   ${c().e1}
    after a call to doSearchPrevious                            ${c().e2}
    after a call to doSearchNext                                ${c().e3}
    after a call to doExecuteSearch                             ${c().e4}
                                                                """
  ...

导致错误的原因是什么,我该如何纠正?

我正在使用Specs2(artifact specs2_2.10)版本1.14。

2 个答案:

答案 0 :(得分:3)

您需要使用更高版本的 specs2 specs2-2.0-RC1specs2-2.0-RC2-SNAPSHOT

答案 1 :(得分:0)

为了其他人阅读本文的好处,我将以下内容放入我的pom.xml:

    <dependency>
        <groupId>org.specs2</groupId>
        <artifactId>specs2_2.10</artifactId>
        <version>2.0-RC2-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>

...以及快照的存储库条目:

    <!--
    We need this repository in order to have access to a snapshot version of
    the Specs2 testing library for Scala. In particular, the snapshot version
    includes support for using string interpolation in test specifications.
    -->
    <repository>
        <id>oss.sonatype.org</id>
        <name>snapshots</name>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>