Created
May 23, 2013 11:50
-
-
Save wteuber/5635528 to your computer and use it in GitHub Desktop.
standup note
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
| ################# CODE ################# | |
| def standup_note | |
| 'heute: Standup ' + ((Time.now.day % 2).zero? ? 'gegen den ' : 'im ') + 'Uhrzeigersinn' | |
| end | |
| ################# PREP ################# | |
| class String | |
| def should_include(part) | |
| raise '...but it does not!' unless self.include?(part) | |
| print '.' | |
| true | |
| end | |
| end | |
| unmock = Time.now.method(:day).to_proc | |
| mock_day = 0; mock = -> {mock_day} | |
| Time.send(:define_method, :day, mock) | |
| ################# SPEC ################# | |
| standup_note.should_include('heute: Standup') | |
| mock_day = 10 | |
| standup_note.should_include('gegen den Uhrzeigersinn') | |
| mock_day = 11 | |
| standup_note.should_include('im Uhrzeigersinn') | |
| ################# CLEAN ################# | |
| Time.send(:define_method, :day, unmock) | |
| class String; undef :should_include; end | |
| ################# EXEC ################# | |
| standup_note |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment