Created
May 1, 2012 10:47
-
-
Save RyanScottLewis/2567257 to your computer and use it in GitHub Desktop.
Rspec: clear terminal before suites in OSX
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
| # omitted... | |
| RSpec.configure do |config| | |
| # omitted... | |
| config.before(:suite) do | |
| if RUBY_PLATFORM =~ /darwin/ | |
| # Focus on Terminal | |
| system %{osascript -e 'tell application "Terminal" to activate'} | |
| # Send CMD+K to clear | |
| system %{osascript -e 'if application "Terminal" is frontmost then tell application "System Events" to keystroke "k" using command down'} | |
| # CMD-TAB to return focus to previous application | |
| system %{osascript -e 'tell application "System Events" to keystroke tab using command down'} | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment