dalekjs / dalek

[unmaintained] DalekJS Base framework
MIT License
695 stars 63 forks source link

feat(suite): bind this to the current test #38

Closed robinboehm closed 10 years ago

robinboehm commented 10 years ago

Bind this to the current test at execution. Semantic: "this is the current test".

No need to use a function argument for accessing DSL.

Example Code:

module.exports = {
    // Checks if the <title> of ´github.com´ has the expected value
    'Page title is correct': function () {
        'use strict';
        this.expect(1);

        this
            .open('http://github.com')
            .assert.title('GitHub')
            .done();
    }
};

Also set test via the arguments array to backward compatibility.

I've also tried to add a test for this, but there is not so much base-tests to extend ... So I'm not so deep enough into dalek to create the initial test-suite.

asciidisco commented 10 years ago

Hi Robin,

thanks for the addition. I know already some people who override this in their test methods, which would make this a breaking change (which is not bad entirely, we will have some of them in the future).

Would live to have more input from @ryanzec & @rodneyrehm before getting this in. Any thoughts guys?

rodneyrehm commented 10 years ago

I don't see how any other context than the unit ("test") could be useful here. And if you wanted to use another context, you could always bind it yourself. Ergo: I have no problem with this idea at this point.

ryanzec commented 10 years ago

I also agree that making this bind to the test makes logical sense.

asciidisco commented 10 years ago

Alright then. Lets get this in. Thanks @robin, especially for getting the commit message right :D Thanks @ryanzec & @rodney for reviewing.

robinboehm commented 10 years ago

:+1:

robinboehm commented 10 years ago

@asciidisco you linked a "random robin" :D haha :100:

asciidisco commented 10 years ago

@robinboehm Ahh. Sorry "random @robin", too much context switching made me mad ;)