public
Rubygem
Description: Johnson wraps JavaScript in a loving Ruby embrace.
Homepage: http://github.com/jbarnette/johnson/wikis
Clone URL: git://github.com/jbarnette/johnson.git
tenderlove (author)
Tue Apr 29 22:43:33 -0700 2008
commit  3361d7c4c9265f431ed3b7ae61c4273fa0e69fbe
tree    c80cd79bdf77ef0fe6afec2d0d00af6aacc7602a
parent  faeef59aae1926e2bda69f1da515eb6d1cbbcd36
johnson / todo / threading_test.rb
100644 23 lines (19 sloc) 0.675 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require File.expand_path(File.join(File.dirname(__FILE__), "/../test/helper"))
 
module Johnson
  module Conversions
    class ThreadTest < Johnson::TestCase
      def setup
        @context = Johnson::Context.new
      end
 
      def test_new_js_thread
        @context.evaluate('function testing() { Ruby.sleep(10); }')
        @context.evaluate('new Ruby.Thread(function() { testing(); })')
      end
 
      def test_js_thread_read_file
        @context['filename'] = File.expand_path(__FILE__)
        @context.evaluate('function testing() { Ruby.File.read(filename); }')
        @context.evaluate('new Ruby.Thread(function() { testing(); })')
      end
    end
  end
end