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

fix: Wait for an instance of a subclass of Promise in Promise.all #15

Merged
merged 1 commit into from Feb 11, 2016

Conversation

dylanahsmith
Copy link
Collaborator

@eapache for review

Problem

I used obj.instance_of?(Promise) in Promise.all to check for promises in the input, but that only returns true if the class of the object is equal to Promise, rather than supporting a subclass of Promise as I intended.

I actually normally just use .is_a? but mutation coverage testing didn't like that, and I thought the only difference between the two was that .instance_of? doesn't work with modules. But really it wanted me to test with subclasses.

Solution

Change .instance_of? to .is_a? and add a regression test.

@eapache
Copy link

eapache commented Feb 11, 2016

👍

dylanahsmith added a commit that referenced this pull request Feb 11, 2016
fix: Wait for an instance of a subclass of Promise in Promise.all
@dylanahsmith dylanahsmith merged commit 8fe543d into lgierth:master Feb 11, 2016
@dylanahsmith dylanahsmith deleted the promise-all-subclasses branch February 11, 2016 19:36
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.

None yet

2 participants