VBA-tools / vba-test

Add testing and TDD to VBA on Windows and Mac
MIT License
202 stars 46 forks source link

SpecDefinition should return its own reference #17

Closed robodude666 closed 6 years ago

robodude666 commented 7 years ago

It would be very helpful if SpecDefinition could return a reference to itself. For example:

With Specs.It("should be a good example")
    Set Foo = Bar.FooBarIt()
    VerifyIsAnObject(.Self, Foo)
End With

Private Function VerifyIsAnObject(ByRef SpecsIt As SpecDefinition, ByRef Foo As Bar)

    With SpecsIt
        .Expect(Foo...).ToBe...
    End With

End Function

While I understand RunMatcher exists, you may not want to make your various functions public. RunMatcher also doesn't support the fluent Expect().ToBe() syntax used throughout the rest of our suites.

timhall commented 7 years ago

Good idea, should be a quick fix, I'll try to get to this shortly.

timhall commented 6 years ago

Nearing a year on this and it's finally on the docket for changes for the v2 change to vba-test