raniejade / spek-idea-plugin

MIT License
48 stars 15 forks source link

Unable to run individual test with on() action #34

Open Jkly opened 7 years ago

Jkly commented 7 years ago

Plugin version: 0.3.4 IDEA 2016.3.5

When trying to run an individual spec within an on() group, the entire spec file is run instead of the individual.

For example, in the screenshot below, I ran it("should return the result of adding the first number to the second number") expecting just that test to run.

screen shot 2017-03-19 at 16 51 43
import junit.framework.TestCase.assertEquals
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
import org.jetbrains.spek.api.dsl.on

object CalculatorSpec: Spek({
    class Calculator {
        fun sum(a: Int, b: Int): Int {
            return a + b
        }

        fun subtract(a: Int, b: Int): Int {
            return a - b
        }

    }

    describe("a calculator") {
        val calculator = Calculator()

        on("addition") {
            val sum = calculator.sum(2, 4)

            it("should return the result of adding the first number to the second number") {
                assertEquals(6, sum)
            }
        }

        on("subtraction") {
            val subtract = calculator.subtract(4, 2)

            it("should return the result of subtracting the second number from the first number") {
                assertEquals(2, subtract)
            }
        }
    }
})
raniejade commented 7 years ago

Yeah, it's a current limitation of the plugin.