xolvio / meteor-rtd-example-project

A template project to use for creating a meteor app with unit and webdriver testing
91 stars 27 forks source link

In the cucumber feature "Actions.verifyTheirScoreIs" is no checking the score #27

Open merunga opened 10 years ago

merunga commented 10 years ago

If you change the last step of the feature from Then "Grace Hopper" has a score of 15 to Then "Grace Hopper" has a score of 500000 The scenario will still pass.

To solve this I included chai.js in the test/lib, and replace this line with

var expect = require('../../lib/chai.js').expect;
expect(parseInt(value)).to.equal(parseInt(points));
samhatoum commented 10 years ago

Thanks for the feedback, What's I forgot to do, is make the callback return with an error the way the cucumber boys do it. Of course you can still use an assertion library. I'll update the example.

ryw commented 10 years ago

I just did what @merunga suggested, and got the example actually asserting correctness.

When I added test/lib/chai.js I got jslint issues, so I had to disable that.

chai.js adds 4k LOC — @samhatoum was there some other vision to make the expectation work besides including chai?

xolvio commented 10 years ago

@ryw we use Jasmine. You can use mocha or any assertion framework you like. I'm wondering though, can't you just exclude chai.js from jslint checking?

ryw commented 10 years ago

It appears that jasmine is already in the project — the work to be done is to integrate jasmine into the feature actions file, right? I'd be happy to do a PR for this as part of my learning on RTD...

xolvio commented 10 years ago

yes. sort of :) jasmine-node runs the acceptance tests as you can see here. This npm module is installed globally and it's probably best to leave that one alone. You can either share the jasmine that karma includes here /test/rtd/node_modules/karma-jasmine, or just include the jasmine assertion library in your code.

ryw commented 10 years ago

Thanks for help @xolvio — did you leave this cucumber feature as you did to give people flexibility to choose their own assertion library, or is the actions.js file just unfinished?

If unfinished, I'll help finish it — sounds like sharing jasmine from karma would be the best solution, vs creating another copy of the library...

xolvio commented 10 years ago

I had set up the feature quickly as a sample and for people to freely use the library they chose, but it would actually be good to include it so the example works. Would love the help. Thanks!