Skip to content

Should lazy Given variables be evaluated before override? #3

@cades

Description

@cades

Currently, this test will pass:

Given x: -> throw new Error 'oops!'
When -> @x = 'override x'
Then -> "it is ok"

but in rspec-given, this will fail.

Javascript provide Object.defineProperties, which allow developers to define getter and setter separately. As a result, execute setter without executing getter is possible. The question here is: which behavior should it have? Does the semantic is consistent with general evaluation rule?

At this moment, I have no idea about this choice. Have to survey how other projects dealing with this issue.

Any suggestion is welcome!

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