facebook/react-rails — pull request #16 by quark-zju (2013-11-27 15:27:24+00:00)
Title: Fix JSXTransformer when therubyracer is used by execjs

The `execjs` gem will try to use native v8 js library https://github.com/cowboyd/therubyracer if it is available. Otherwise `execjs` will try to execute external `node`, which is the case in current tests.

The problem is, `node` has `global` defined but `therubyracer` doesn't:

```ruby
require 'v8'
require 'execjs'

context = ExecJS.compile('') # ExecJS::RubyRacerRuntime::Context
puts context.eval('global') # ReferenceError: global is not defined (ExecJS::ProgramError)
```

JSX cannot work properly with neither `global` nor `window` defined. This pull request fixes it by defining `global`. I also added tests for the change and fix some other small issues I found.