-
-
Save bolshakov/5d17f998efeee1bb1f13ca1f67d8bc54 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
| abstract struct A | |
| def self.build(value) | |
| if value.nil? | |
| B.new | |
| else | |
| C.new | |
| end | |
| end | |
| end | |
| struct B < A | |
| end | |
| struct C < A | |
| end | |
| describe A do | |
| it "C" do | |
| result = A.build(42) | |
| result.should eq(C.new) | |
| end | |
| it "B" do | |
| result = A.build(nil) | |
| result.should eq(B.new) | |
| end | |
| end |
Author
bolshakov
commented
Sep 27, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment