Skip to content

Instantly share code, notes, and snippets.

@madpilot
Created August 11, 2010 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madpilot/519205 to your computer and use it in GitHub Desktop.
Save madpilot/519205 to your computer and use it in GitHub Desktop.
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