This file contains 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
(def *horizontal-blinker* [ [0,1] [1,1], [2,1] ]) | |
(def *vertical-blinker* [ [1,2] | |
[1,1] | |
[1,0] ]) | |
(example "of blinkers blinking" | |
(next-world horizontal-blinker) =>? vertical-blinker | |
(next-world vertical-blinker) =>? horizontal-blinker |
This file contains 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
def should(&a_block_that_is_never_called) | |
stash_block { | |
puts "block_given? is #{block_given?}." | |
} | |
end | |
def stash_block(&block) | |
$block = block | |
end |
This file contains 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
require 'minitest/unit' | |
require 'rubygems' | |
require 'mocha' | |
MiniTest::Unit.autorun | |
class SampleTests < MiniTest::Unit::TestCase | |
def test_do_something | |
# assert { 1 + 1 + 3 == 2 } |
This file contains 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
2010-05-04 11:00:19.874 macruby[16526:903] *** Terminating app due to uncaught exception 'NoMethodError', reason: '/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/minitest/unit.rb:410:in `block': undefined method `run' for #<SampleTests:0x2002bf160> (NoMethodError) | |
from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/minitest/unit.rb:409:in `block' | |
from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/minitest/unit.rb:407:in `run_test_suites:' | |
from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/minitest/unit.rb:375:in `run:' | |
from /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/1.9.0/minitest/unit.rb:329:in `block' | |
' |
This file contains 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
def test_creation_of_a_key_file | |
contact = Contact.contactWithHash(:a_key => Base64.encode64("certificate info"), | |
:organization => "mom & pop") | |
collaborators(:folder, :certificate_maker) | |
hardwired(contact, :certificate_maker) | |
during { | |
contact.stash_this_key(:a_key, @folder) | |
}.behold! { |
This file contains 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
Open3.popen3("openssl x509 -inform der") do | stdin, stdout, stderr | | |
stdin.write(text) | |
stdin.close | |
stdout.read | |
end |
This file contains 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
def downloadFullDirectory(sender) | |
post(News::TimeToUpdateDirectory) | |
end |
This file contains 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
def showReloadProgress(ignored_notification) | |
@tabView.selectTabViewItemWithIdentifier(DIRECTORY_TAB) | |
@collectionView.setHidden(true) | |
@progressIndicator.startAnimation(self) | |
end |
This file contains 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
def load(ignoredNotification) | |
# If a user gesture provoked this notification, we have | |
# to give UI objects' responses a chance to get painted | |
# on the screen before we start hogging processing. | |
postNotificationAfterRunLoop(News::ResumeDeferredLoad, self) | |
end | |
def resumeDeferredLoad(notification) | |
remove_observer_of_named_notification(self, News::ResumeDeferredLoad) | |
result = @savon_client.get_full_directory_list |
This file contains 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
def test_that_any_blocking_actions_are_deferred_until_UI_has_had_a_time_to_repaint | |
during { | |
post(News::TimeToUpdateDirectory) | |
}.behold!{ | |
@sut.expects(:postNotificationAfterRunLoop).with(News::ResumeDeferredLoad, @sut) | |
} | |
end |
OlderNewer