therubyrhino/spec/spec_helper.rb

39 lines
628 B
Ruby
Raw Normal View History

2009-09-25 00:06:31 +00:00
require 'rhino'
2012-04-13 18:32:31 +00:00
2013-03-11 07:46:18 +00:00
begin
require 'mocha/api'
rescue LoadError
require 'mocha'
end
2012-04-13 18:32:31 +00:00
require 'redjs'
module RedJS
Context = Rhino::Context
Error = Rhino::JSError
end
module Rhino
module SpecHelpers
def context_factory
@context_factory ||= Rhino::JS::ContextFactory.new
end
def context
@context || context_factory.call { |ctx| @context = ctx }
@context
end
def scope
context.initStandardObjects(nil, false)
end
end
end
RSpec.configure do |config|
config.filter_run_excluding :compat => /(0.5.0)|(0.6.0)/ # RedJS
config.include Rhino::SpecHelpers
end