Skip to content

Instantly share code, notes, and snippets.

@mcmire
Last active May 15, 2020 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcmire/d9418edcadb01801ab52f2ab9a199007 to your computer and use it in GitHub Desktop.
Save mcmire/d9418edcadb01801ab52f2ab9a199007 to your computer and use it in GitHub Desktop.
super_diff #81

Let's say you have this test:

expected = {
  created_at: "Tue Jan 13 19:28:24 +0000 2009",
  favourites_count: 38,
  geo_enabled: false,
  verified: true,
  media_count: 51_044,
  statuses_count: 273_860,
  contributors_enabled: false,
  profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
  profile_background_color: "FFF1E0",
  profile_background_tile: false,
  profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
  listed_count: 37_009,
  profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
}

actual = {
  listed_count: 37_009,
  created_at: "Tue Jan 13 19:28:24 +0000 2009",
  favourites_count: 38,
  utc_offset: nil,
  statuses_count: 273_860,
  media_count: 51_044,
  contributors_enabled: false,
  is_translator: false,
  is_translation_enabled: false,
  profile_background_color: "FFF1E0",
  profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
  profile_background_tile: false,
  profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592",
}

expect(actual).to eq(expected)

Prior to this PR, super_diff would produce:

  {
    listed_count: 37009,
    created_at: "Tue Jan 13 19:28:24 +0000 2009",
    favourites_count: 38,
+   utc_offset: nil,
    statuses_count: 273860,
    media_count: 51044,
    contributors_enabled: false,
+   is_translator: false,
+   is_translation_enabled: false,
    profile_background_color: "FFF1E0",
    profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
    profile_background_tile: false,
    profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592"
-   geo_enabled: false,
-   verified: true,
-   profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
  }

Now it produces:

  {
    listed_count: 37009,
    created_at: "Tue Jan 13 19:28:24 +0000 2009",
    favourites_count: 38,
-   geo_enabled: false,
-   verified: true,
+   utc_offset: nil,
    statuses_count: 273860,
    media_count: 51044,
    contributors_enabled: false,
+   is_translator: false,
+   is_translation_enabled: false,
    profile_background_color: "FFF1E0",
    profile_background_image_url_https: "https://abs.twimg.com/images/themes/theme1/bg.png",
    profile_background_tile: false,
-   profile_image_url: "http://pbs.twimg.com/profile_images/931156393108885504/EqEMtLhM_normal.jpg",
    profile_banner_url: "https://pbs.twimg.com/profile_banners/18949452/1581526592"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment