Skip to content

Comments

Extract min_diff from GoBoundless/www#53

Open
jelder wants to merge 4 commits intomasterfrom
min_diff
Open

Extract min_diff from GoBoundless/www#53
jelder wants to merge 4 commits intomasterfrom
min_diff

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
Contributor

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