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

Extract min_diff from GoBoundless/www #53

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Extract min_diff from GoBoundless/www #53

wants to merge 4 commits into from

Conversation

jelder
Copy link
Contributor

@jelder jelder commented Apr 27, 2016

This was previously a monkey-patch in our main app. I've extracted it here, but I think having it all in one file may be a little unclean. invert_actions and sort_actions (with the supporting ChangeGroup) could live elsewhere, but I'm not sure where the existing structure would accept stuff like this.

let(:regular_diff) { Dyph::Differ.two_way_diff(left, right) }
let(:subject) { Dyph.min_diff(left, right) }

its(:length) { is_expected.to be < regular_diff.length }
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, what if instead of just checking that the length is smaller, we check to ensure it matches Dyph::Differ.two_way_diff(right, left)? Optionally also checking that Dyph::Differ.two_way_diff(right, left) < Dyph::Differ.two_way_diff(right, left) so if the test fails, we know it's because of min_diff and not that two_way_diff perhaps got better?

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.

2 participants