Last active
March 21, 2018 19:27
-
-
Save guillec/848dcb88c756d4ba34e71416d1b4a262 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Voyage | |
def prepare_voyage(vessel) | |
vessel.prepare | |
end | |
end | |
class Vessel | |
def prepare | |
.. do stuff .. | |
end | |
end | |
.. test .. | |
class VoyageTest | |
test "should prepare a vessel" do | |
os = OpenStruct.new(:prepare) | |
assert Voyage.new.prepare_voyage(os) | |
end | |
end | |
## If we update vessel to not have a prepare method ## | |
class Vessel | |
def not_prepare | |
.. do stuff .. | |
end | |
end | |
Our unit test for vessel will fail because prepare will no longer exists but we caught it and we can fix it. | |
Our unit test for voyage will pass because we are passing in a os that responds to prepare. | |
Our production work will fail because vessel no longer responds to prepare |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment