Skip to content

Commit

Permalink
Upgrade bundled spek to v1.1.0-beta3
Browse files Browse the repository at this point in the history
  • Loading branch information
raniejade committed Jan 5, 2017
1 parent 045fe86 commit a88a35b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
7 changes: 5 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Change Log

## Unreleased
- Ensure compatibility with Spek `1.1.0-beta3`
- Upgrade to Kotlin 1.0.6

## v0.3.2
- Ensure compatibility with Spek `1.1.0-beta3`.
- Upgrade to Kotlin 1.0.6.
- Upgrade bundled Spek to `1.1.0-beta3`.

## v0.3.1
- Decouple persisted metadata from **JUnit Platform**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.jetbrains.jps.model.java.JavaSourceRootType
import org.jetbrains.kotlin.asJava.toLightClass
import org.jetbrains.kotlin.idea.core.getPackage
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
import org.jetbrains.spek.tooling.Target

Expand All @@ -27,7 +27,7 @@ class SpekRunConfigurationProducer: JavaRunConfigurationProducerBase<SpekRunConf
var configurationSet = false
if (!sourceElement.isNull) {
val element = sourceElement.get()!!
if (element is KtClass) {
if (element is KtClassOrObject) {
// when clicking on the class file in the project view
val cls = element.toLightClass()
if (cls != null && SpekUtils.isSpec(cls)) {
Expand Down Expand Up @@ -56,7 +56,7 @@ class SpekRunConfigurationProducer: JavaRunConfigurationProducerBase<SpekRunConf
val parent = element.parent
if (parent != null) {
when (parent) {
is KtClass -> {
is KtClassOrObject -> {
val cls = parent.toLightClass()
if (cls != null && SpekUtils.isSpec(cls)) {
if (cls.qualifiedName != null) {
Expand Down Expand Up @@ -102,7 +102,7 @@ class SpekRunConfigurationProducer: JavaRunConfigurationProducerBase<SpekRunConf
var target: Target? = null

if (element != null) {
if (element is KtClass) {
if (element is KtClassOrObject) {
val cls = element.toLightClass()
if (cls != null && SpekUtils.isSpec(cls)) {
target = Target.Spec(cls.qualifiedName!!)
Expand All @@ -125,7 +125,7 @@ class SpekRunConfigurationProducer: JavaRunConfigurationProducerBase<SpekRunConf
val parent = element.parent
if (parent != null) {
when (parent) {
is KtClass -> {
is KtClassOrObject -> {
val cls = parent.toLightClass()
if (cls != null && SpekUtils.isSpec(cls)) {
target = Target.Spec(cls.qualifiedName!!)
Expand Down
5 changes: 2 additions & 3 deletions plugin/src/main/kotlin/org/jetbrains/spek/idea/SpekUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.jetbrains.kotlin.idea.util.findAnnotation
import org.jetbrains.kotlin.lexer.KtToken
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtLambdaArgument
import org.jetbrains.kotlin.psi.KtLambdaExpression
Expand Down Expand Up @@ -90,15 +89,15 @@ object SpekUtils {
}

fun isContainedInSpec(callExpression: KtCallExpression): Boolean {
val container = KtStubbedPsiUtil.getContainingDeclaration(callExpression, KtClass::class.java)
val container = KtStubbedPsiUtil.getContainingDeclaration(callExpression, KtClassOrObject::class.java)
if (container != null) {
return isSpec(container)
}
return false
}

fun getContainingSpecClass(callExpression: KtCallExpression): KtLightClass? {
val container = KtStubbedPsiUtil.getContainingDeclaration(callExpression, KtClass::class.java)
val container = KtStubbedPsiUtil.getContainingDeclaration(callExpression, KtClassOrObject::class.java)
if (container != null && isSpec(container)) {
return container.toLightClass()
}
Expand Down
4 changes: 2 additions & 2 deletions tooling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlinVersion"

// TODO: remove api reference, until we publish proper POM metadata
runtime 'org.jetbrains.spek:spek-api:1.1.0-beta2'
runtime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.0-beta2'
runtime 'org.jetbrains.spek:spek-api:1.1.0-beta3'
runtime 'org.jetbrains.spek:spek-junit-platform-engine:1.1.0-beta3'
compile 'org.junit.platform:junit-platform-launcher:1.0.0-M3'
compile 'net.sf.jopt-simple:jopt-simple:5.0.3'
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.8.4'
Expand Down

0 comments on commit a88a35b

Please sign in to comment.