Skip to content

Instantly share code, notes, and snippets.

@tigershen23
Last active February 17, 2019 21:41
Show Gist options
  • Save tigershen23/a126a60c61a797d49c7dfbdda363d167 to your computer and use it in GitHub Desktop.
Save tigershen23/a126a60c61a797d49c7dfbdda363d167 to your computer and use it in GitHub Desktop.
Perceptual Learning Playlist of Ruby Unit Tests
  • Thor::Util#snake_case: well-isolated test cases. Clear and thorough about expected behavior with potentially ambiguous input
  • HTTParty.normalize_base_uri: describes behavior well for a method that might be confusing at first
  • Virtus::Attribute#==: good use of intermediate variable for clarity. tests are collectively exhaustive within the scope of the method
  • AASM::Core::Event#fire: good isolation of complex behavior; good use of mocks and doubles. when/then/expect division is clear (BDD). good use of context
  • Money.from_amount: documents valid and invalid inputs. Covers both default and configurable behaviors
  • Sidekiq.❨╯°□°❩╯︵┻━┻: correct setup and teardown of resources
  • fast_blank: comprehensive backwards-compatibleness tests. use of loops to succinctly generate lots of related test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment