Created
August 11, 2010 15:52
-
-
Save madpilot/519205 to your computer and use it in GitHub Desktop.
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 'test_helper' | |
class SyncTest < Test::Unit::TestCase | |
include TestHelper | |
context 'SyncTest' do | |
setup do | |
setup_context | |
Titanium.include('lib/88miles.js') | |
Titanium.include('lib/sync.js') | |
end | |
context 'start' do | |
should 'fire onStart when start is called' do | |
# Seems like you can't set expectations in mocha, | |
# so it gets mocked in the JS context | |
company = mock | |
@context['Company'] = company | |
callback = Proc.new {} | |
callback.expects(:call) | |
@context['callback'] = callback | |
@context.evaluate <<-JS | |
EightyEightMiles.Company = Company; | |
Company.find = function() {} | |
var sync = new Sync('Company', { | |
onStart: callback | |
}); | |
sync.start(); | |
JS | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment