-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Change by delta (New Assertion) #621
Conversation
I think Option 1 sounds like the best idea 😄. |
// This gets flagged because of the .by(delta) assertion | ||
flag(this, 'msgObj', msgObj); | ||
flag(this, 'initial', initial); | ||
flag(this, 'final', final); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sold on the names of these flags. They're very likely only going to be used by the increase/decrease/change set - having then more specific to that would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed 👍
I'm gonna do it
Thanks for your feedback! It was very valuable (as always) 😄 |
Hi @keithamus, sorry for the delay on this. Well, I've got a doubt here about the behavior of When someone uses, for example, If so, how can we detect there is a (TL;DR; version: using |
Presumably |
Yes, exactly, currently I'm making
I'll make sure to explain everything I did when adding it to this PR. |
Okay, so, after days analyzing this I came to a dead end, so let me explain the problem we have here and the possible solution: Q: What is the problem? Q: Why does this happen? Q: And how can we solve this?
Using it this way the Also, on the Please, @keithamus and others, feel free to give feedback/ideas. Thanks for your time PS.: If you want more time to talk about this we can also chat through skype, hangouts or anything else. |
@lucasfcosta thanks for the detailed description of the issue, however I'm not sure it is that much of a problem. If You mention |
@keithamus, Yes, it works right out of the box, because I just need to add I will make sure to make this PR as clean as possible so you can take a look at the final version of these changes. Thanks for your feedback! I'll probably commit the code for this until tomorrow. |
63701b3
to
da0f50c
Compare
da0f50c
to
10a0bbc
Compare
Well, it's done. |
Great work @lucasfcosta. Happy to merge this in 😄 |
[WIP] Change by delta (New Assertion)
As discussed on #339 this is the implementation of the
by
assertion.I've tagged this as WIP because I want to confirm with you guys (especially @keithamus, since he is the one involved issue #339) how this is going to get implemented on the
assert
interface.I thought about two possible ways to do it, here they are:
Create six new methods, one for each of the change related methods of this interface.
Doing this seems redundant and cumbersome, but this seems to follow the pattern of the rest of the interface.
If we did this, we would have these new methods:
changesBy
,doesNotChangeBy
,increasesBy
,doesNotIncreaseBy
,decreasesBy
anddoesNotDecreaseBy
.I also think this is the most adequate approach.
Return the created assertion and allow the user to chain the
.by()
assertion.The interface's methods would be something like:
Personally, I don't like this because it adds a new kind of behavior to this interface. It seems to be cleaner but actually it causes a mess because it does not follow the other method's patterns
You can also feel free to suggest other improvements and point mistakes, I will always be open to others' opinions.