Skip to content

Invariant should be enough to run a test #28

@TheLudd

Description

@TheLudd

I encountered a situation today where I want to group expectations for a range of inputs to a function. Some inputs should give a return value a, other inputs should give return value b. I thought I could group these assertions with an Invariant but since I lack a Then the tests are never executed.

Pseudo suite:

    describe 'I want the same result for different inputs', ->
        When -> @subject @input
        Invariant -> expect(@result).toBe 'the same'

        describe '- input foo', ->
            Given -> @input = foo

        describe '- input bar', ->
            Given -> @input = bar

Would it be possible to make an Invariant enough to run the code inside all affected describe blocks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions