Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant should be enough to run a test #28

Open
TheLudd opened this issue Mar 17, 2014 · 2 comments
Open

Invariant should be enough to run a test #28

TheLudd opened this issue Mar 17, 2014 · 2 comments

Comments

@TheLudd
Copy link

TheLudd commented Mar 17, 2014

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?

@searls
Copy link
Owner

searls commented Mar 18, 2014

I am not sure I agree, but I do understand that a test branch with no Then statements can be confusing.

On Mon, Mar 17, 2014 at 10:01 AM, Ludwig Magnusson
[email protected] wrote:

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?

Reply to this email directly or view it on GitHub:
#28

@bostonaholic
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants