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

Added fail() method to Should and Expect interfaces #356

Merged
merged 6 commits into from
Feb 10, 2015

Conversation

Soviut
Copy link

@Soviut Soviut commented Jan 30, 2015

Should and Expect now have fail() methods like Assert does.

should.fail(0, 1, 'failure message');
expect().fail('failure message');

Please pay special attention to the Expect implementation as I wasn't totally certain how all of it worked. It may not be fully chainable, though it's not really intended to be.

@@ -21,7 +21,7 @@
},
"main": "./index",
"scripts": {
"test": "make test"
"test": "mocha --require ./test/bootstrap"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an extraneous change. Could you rebase it out please?

@keithamus
Copy link
Member

Some good work so far @Soviut. Couple of notes above which I'd like to see addressed - if you could be so kind. Also, as you've noted in the code, it'd be great to get some documentation put in here too 😄

if (msg) flag(this, 'message', msg);
var obj = flag(this, 'object');
throw new chai.AssertionError(msg, {}, obj);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another point to make here; for API consistency I think should.fail and expect.fail should work exactly the same as assert.fail. Method signature and all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the consistency. I chose this route because I was trying to be consistent with the interface. Namely, that values are usually passed along the chain with expect. I'll try reworking it.

@Soviut
Copy link
Author

Soviut commented Feb 10, 2015

@keithamus There is now an expect.fail(0, 1, 'message'); method. Does this look good now?

@keithamus
Copy link
Member

Looks fantastic @Soviut.

Could you add a little bit of documentation above each of the methods in the code? This way it'll get carried over onto the site documentation when the site is regenerated.

@Soviut
Copy link
Author

Soviut commented Feb 10, 2015

Will do.

@Soviut
Copy link
Author

Soviut commented Feb 10, 2015

@keithamus documentation added. I basically just copied what was already in the assert interface.

@keithamus
Copy link
Member

Perfect. Consider it merged 👍

keithamus added a commit that referenced this pull request Feb 10, 2015
Added fail() method to Should and Expect interfaces
@keithamus keithamus merged commit 9b25d0c into chaijs:master Feb 10, 2015
@sieira
Copy link

sieira commented Aug 22, 2015

Sorry for bothering you, but I can't manage to find the docs for this...

@keithamus
Copy link
Member

@sieira the website is outdated right now. We're working on it. chaijs/chaijs.github.io#74

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

Successfully merging this pull request may close these issues.

3 participants